Japan was an empire and World War II in the Pacific Theater was essentially imperial competition. The British and French, as well as the Dutch had colonies and forces in Asia, and represented a threat to Japan's hegemony (dominance) in the region. As Hitler conquered these places and threatened Britain to within an inch of its life, it became easier for Japan to take their holdings in Asia.
That meant the US was the only remaining unengaged, fully armed empire that could stand in their way. While we had disagreements with Imperial Japan at the time, and tension was high, the simple and most compelling reason for them to attack us on December 7th was because we were the only ones left in their way.
Once the Japanese started to think about expanding past China, the US Navy was their biggest worry. This is why they bombed the US fleet at Pearl Harbor.
For Japan to expand out of China, it was going to have to go by sea to the south. This expansion would be in danger if the US Navy was strong. The US would be able to harass and attack Japanese shipping between the home islands of Japan and its armies trying to take or hold an empire.
By bombing Pearl Harbor, they hoped to make it so the US fleet could not intervene (taking the Philippines helped with this too).
A consensus had been reached from a series of imperial conferences that Japan would need to fight the US to obtain victory in Southeast Asia. To prevail in a protracted conflict, Japane needed high levels of raw materials and the only way to obtain the resources from Southeast Asia was to provoke the US into a war through a surprise attack. The attack on the US would give the Japanese the time they needed to attain the resources they required and to further expand its own industrial capability. It was thus necessary for the Japanese navy to first destroy the American Pacific fleet and challenge US naval supremacy since it was the only potent force that could halt the Japanese advance in the region. By destroying the battle fleets that were located at Pearl Harbour, Japan would be able to gain the time they needed to erect a giant barrier around Southeast Asia, which when guarded by the imperial navy, could keep the US at bay. A knockout blow at sea was also essential to gain the psychological ascendancy they needed to drag out the war so as to force the Americans out of it - they were sure that the Americans would not be invested into fighting a protracted conflict in a region that they would not familiar with.