The immediate purpose of Japan's attack on the United States in 1941 was to destroy the U.S. Pacific Fleet. Japan saw the United States as a potential hindrance in their plan to conquer Malaya and the Dutch East Indies to secure needed resources.
After the Japanese invasion of China in 1937 and French Indochina in 1940, the United States began to restrict trade with Japan. In 1940, it ceased exporting airplanes, airplane parts, aviation fuel and machine tools to Japan, and in 1941, it stopped the export of oil. This intensified the Japanese need for rubber from Malaya and oil from the Dutch East Indies. Since President Franklin Roosevelt warned Japan against attacking any other Southeast Asian countries, and negotiations with the United States had been unsuccessful, Japan saw no alternative to destroying the main threat to their plans for expanding the war.
In attacking the U.S. Pacific Fleet at Pearl Harbor, Japan hoped to not only destroy the U.S. naval presence in the Pacific, but to also inflict a significant blow to the morale of the United States. Japan reasoned that if the attack was devastating enough, it might discourage the United States from entering the war. Instead, on December 8, one day after the Japanese attack on December 7, the United States formally declared war on Japan.