The purpose for the attack on pearl harbor was so that the Japanese military can destroy "the knife pointed to Japan's throat" or the US Navy. The US navy at the time was one of the few things that could have stopped the Japanese expansion in a fight, and with the US asking them to stop, they knew that they would have to fight sooner or later. The attack on Pearl harbor was also a way to get the US "awakened" to their surroundings, and to have them join as Japan's ally (which backfired tremedously)
hope this helps