Douglas C. Miller
, I have been reading history for over 50 years
Most of the other answers have significant parts of the full answer as to why Japan attacked Pearl Harbor, but none put the whole thing together. So let me try:


Thus Japan fell into a somewhat fascist-like state in which the military dominated the government, and increasingly it limited the press, civil rights, and other liberties in the name of patriotism. The Constitution required that the Army Minister be a serving officer, ditto the Navy Minister, and the resignation of either of these figures would bring down the Cabinet and force the Emperor to find a new Prime Minister to reorganize the government. Thus the military held ultimate power over the civilian government, no matter who had a majority in the Diet (Parliament).


In 1937 the Japanese military again went “off the reservation” and against orders began a new aggression against China. The US, by now under the leadership of FDR, was strongly against this, and not only remonstrated with the Japanese but began to consider the Japanese as potentially hostile. This fit with FDR’s view of Hitler and Mussolini, and he regarded the Japanese as of the same ilk. He began to reverse the American policy of not reinforcing and modernizing the military installations we had in the Philippines, and on Wake Island and Midway, although the US was limited by treaties which pledged not to fortify those places. (The Japanese were pledged not to fortify the islands they had taken from the Germans after WW I under League of Nations mandates, but they cheated, just as they ended up cheating on the naval treaties).


III) The Chinese war goes badly: From 1937 the war in China came to resemble, in modern terms, the US experience in Vietnam. The Japanese never lost a battle, they took territory, but they could not “win”; Chiang and Mao retreated but never surrendered, and the Japanese were slowly bleeding men and money and oil reserves and metal for planes and tanks, etc. As they became more obviously brutal to the rest of the world, the US obxtions grew, until in the end FDR moved the Pacific fleet to Hawaii as a gesture of deterrence, reinstated MacArthur as an active US officer and instructed him to build a modern Filipino military, and otherwise took actions to protect US trade routes and US facilities such as at Wake and Midway. The Japanese viewed these as threatening gestures. Ultimately, as relations deteriorated further, FDR put in place an embargo on materials that would support the Japanese war, including steel, aluminum, other metals and ores, and, most importantly, petroleum. He also got the Dutch, who by now were a government in exile in Britain with their country occupied by Hitler, to also embargo their oil. The Japanese faced a crisis: they could not maintain their campaigns in China without oil and metals, and they had no resources sufficient to themselves. They resolved, after a lot of discussion, to go take the Dutch islands, and to get Malaya from the British for its tin and its rubber, two other essential commodities. They were inhibited from going north into Siberia by a punishing small campaign they had against USSR troops led by Zhukhov, who badly defeated the Kwangtung Army forces.


IV) Pearl Harbor: So, having resolved to take what they needed in the western Pacific, they examined the risks. The Philippines lie right on the seaways between Malay, Indochina, Indonesia, and Japan; a US fleet and US airforce in the Philippines could interdict Japanese shipping along those routes. So any attack had to include taking the Philippines (or so they reasoned). Yamamoto, by now in command of the IJN’s main fleet, reasoned that they would lose a war to the US, unless they could knock out the Pacific fleet and then convince the US to sign a peace treaty. He therefore developed the Pearl Harbor attack plan and, after a lot of negotations, sold it to the Imperial Army leaders who by now openly ran the government (Tojo was Prime Minister) and, not incidentally, to Hirohito. So the ultimate reasons for the attack on Pearl was not just oil, or just colonialism, but all of what I have laid out here.