Why did Japan attack Pearl Harbor and how did this affect the European War?
This is a very in depth question to which a short, simple answer
is attempted here.
Japan was involved with a war on the Chinese mainland. A US
embargo of sales of strategic materials to Japan threatened the
Japanese economy. The Japanese felt that the US was trying to stop
their military activity by curtailing the resources they critically
needed. This led to Japan looking to conquer areas containing
strategic raw materials to make itself self sufficient.
The European powers, UK, France, Belgium, etc. held as colonies
those regions it would need to obtain this independence. They were
involved in the European War and would not be able to oppose
Japanese takeover of their Pacific and far eastern colonies.
The US, however, was a major military power not yet engaged in
war, and with substantial interests in the region, including the
Philippine Islands, then scheduled to receive independence from the
US in 1946.
The decision was made to preempt US involvement by making key
strategic strikes at the US bases in the Pacific as part of the
makeover of European colonies.
As for how it affected the European War, the Axis never tried to
coordinate their actions as the Allies did. The primary impact on
the European war was that the US became a belligerent there as well
as against Japan. If Japan had not attacked the US, it is possible
that any US involvement in the European war would have been delayed
so long as to lead to the fall of England and perhaps a peace with
the Soviet Union.
If the Axis had coordinated, things might have turned out
differently. If Japan had attacked the Soviet Union, key resources
that Stalin released to stop the German drive on Moscow would not
have been available. "Germany first" was the decision of the Allies
once the US became an active participant.