Japan did this because it wanted to have a large empire in East Asia. Japan felt that it deserved to be the major power in its region of the world. It did not want the US to try to stand in its way. Therefore, it attacked the US at Pearl Harbor.
Japan felt that it was powerful enough to be a major imperial country just like the US, England, and France were. It felt that it should have a large sphere of influence in East and Southeast Asia. It felt that it needed this empire so that it could be taken seriously as a major power. It also wanted the empire to provide it with the raw materials it lacked on the home islands and with a place for excess population to live.
Even before World War II began, Japan was working on this empire. Notably, it was trying to take more and more territory from China. When WWII broke out, Japan also thought that it could gain the Asian territories of allied countries that seemed to be losing the war. It felt it could take places like Indochina, Indonesia, Hong Kong, and Singapore.
Japan felt that the only thing that could stop it from taking this empire was the United States. Therefore, it tried to reduce the US’s ability to influence its actions. This was the point of the Japanese attack on Pearl Harbor.