Long-Term: Japan wanted more land and America would stop them.
“Japan sought to imitate Western countries such as the United States, which had established colonies in Asia and the Pacific to secure natural resources and markets for their goods. Japan’s process of imperial expansion, however, put it on a collision course with the United States, particularly in relation to China. To a certain extent, the conflict between the United States and Japan stemmed from their competing interests in Chinese markets and Asian natural resources” (NationalWW2Mueseum).
Japan got America in WWII because they were competing for Chinese markets and Asian resources, and for Japan to get rid of that competition they attacked their competitors.
Short-Term: Japan wanted to get more resources and Pearl Harbor was a naval base in the way of their plan.
“Japan attacked the U.S Pacific Fleet at its base at Pearl Harbor on the 7th of December 1941, but what led to that decision? Why did the Japanese attack the USA? - The answer is oil.
Japan had been modernizing its economy throughout the 20th century and wanted to build an empire of its own. However, Japan lacked the natural resources to make it a reality, with all but 6% of its oil supply being imported. After capturing Manchuria, Japan became bogged down in a full-scale war with China in 1937 and had to look elsewhere for the resources it needed to fight. Meanwhile, the USA was slowly awakening from its isolationism.” (Imperial War Museums.) https://www.history.com/articles/pearl-harbor
Japan attacked Pearl Harbor because they needed oil. Japan wanted to build a new economic empire, but they lacked the resources to do so. 6% of its oil supply was imported. They then eventually got into a war with China in 1937 and they needed resources to fight.