The Japanese had been involved in a major war in China since 1937. The US felt that this was contrary to their interests, and after the Japanese invaded the French colony of Indochina, began an embargo of oil and scrap metal. These were highly important strategic resources for Japan - they had very little domestic oil production, and limited access to good-quality steel for producing ships and other weapons of war. As a result of the embargo, they needed to find other ways of obtaining such resources. The most obvious locations for this were Malaysia and Indonesia - one a British colony, the other Dutch. The Japanese began planning for a southward invasion against these colonies. However, such a plan had a significant risk. The Philippine islands, essentially a colony of the United States, sat directly on the sea routes between the Japanese bases (both in Japan and on Taiwan) and the "Southern Resource Area" (Malaysia and Indonesia). It would be easy for American ships, submarines and aircraft operating from the islands to cut off Japanese forces in Indonesia, and prevent any resources flowing back to Japan. The US was building up strength in the Philippines, and looked likely to respond forcefully to any further Japanese attack on the European colonies in South-East Asia. Hence, the Philippines had to be captured, as a pre-requisite for exploitation of the resources of Indonesia and Malaysia. However, doing this would cause an American naval response. The Japanese planned to defeat this response in a single decisive battle, wiping out the entire American fleet, and hopefully causing the Americans to acquiesce to Japanese dominion over South-East Asia. This wasn't as crazy as it sounds - the Japanese had been able to do exactly this to Russia in 1905. To ensure that the decisive battle occurred on Japanese terms, the Japanese needed to construct a defensive perimeter, to attrit the American fleet with air and submarine attacks as it travelled to the Philippines. However, many of the islands needed to form this defensive perimeter were held by the British Empire or the USA. These islands had to be captured without the American Pacific Fleet intervening. Attacking Pearl Harbor prevented the fleet from sortieing to interfere with these landing operations, and the subsequent fortification.
Its also worth mentioning the state of dis-function Japanese politics were in by the late 1930's. While the Emperor technically wielded supreme authority, his approval was essentially a rubber stamp formality, the true power lay in the Ministerial cabinet, lead by the Prime Minister. Up until October, 1941, the prime minister of Japan was a man named Konoe Fumimaro. Konoe essentially got pressed between a rock and a hard place. He couldn't pull Japan out of China as the US demanded or risk national humiliation and there was pressure from the Navy to avoid a war with the United States at all costs. In the end Konoe failed to negotiate a settlement with the United States, and resigned. In his place, Tojo Hideki was chosen. Tojo, an Army General, had been one of the most prominent voices in favor of war with the United States. The Navy was then caught in a position where if they opposed war with the United States, it would appear they were unable, or unwilling to fight.
Most of my information comes from the book "Japan 1941" by Eri Hotta