Answer by Harold Kingsberg:
The short version: Japan’s actions from 1852 to 1945 were motivated by a deep desire to avoid the fate of 19th-century China and to become a great power.
For Japan, World War II grew from a conflict historians call the Second Sino-Japanese War. The Second Sino-Japanese War began in earnest in 1937 with a battle called the Marco Polo Bridge Incident. However, before this, there had been years of border clashes between the Japanese and the Chinese, having started with the 1931 Japanese invasion of Manchuria. So, to explain Japan’s behavior in the years from 1941 to 1945, we have to explain why Japan invaded Manchuria in 1931, and in order to do this, we have to go back to 1853.
Before 1852, Japan was isolationist. Contact with the West was limited to trade with the Dutch in the city of Nagasaki—Westerners otherwise weren’t allowed in the country, and Western influences were strongly discouraged. In 1853, Commodore Matthew C. Perry of the United States Navy steamed into what we now call Tokyo Bay. The Japanese told him to leave and go to Nagasaki. He ignored the directive and was surrounded by the Japanese fleet. He presented a counterdemand to have a letter from U.S. President Millard Fillmore presented to the de facto ruler of Japan at the time, the shogun. When this demand was not met, he shelled a few buildings in the harbor. The letter was presented. Perry returned a year later to sign the Convention of Kanagawa, a treaty that opened the Japanese ports of Shimoda (a city between Kyoto and what we now call Tokyo and was then called Edo) and Hakodate (located on the northern island of Hokkaido) to U.S. trade. The terms were dictated by the Americans, and the Japanese had little choice but to agree, seeing that they were seriously technologically outmatched.
This is where modern Japanese history begins. The importance of Perry’s missions to Japan in the 1850s really can’t be overstated. While Japan had previously thought itself to be a strong country, Perry’s actions and the signing of treaties widely viewed in Japan as unequal destroyed this image. While Japan’s isolation had allowed the Japanese to think that they might escape the fate the Chinese were suffering, the end of this isolation gave lie to that idea.
The Japanese were petrified that they’d go the same way China did, and it wasn’t very long before a reform movement got started. In 1868, this reform movement led to what we now call the Meiji Restoration. The shogun was stripped of his power, which was then nominally placed back in the hands of the emperor but really into the hands of his advisers. In a very brief span of time, the feudal system that had governed Japanese society for centuries was abolished, the military was reformed, and the country was put on the path to industrialization.
The Japanese knew they had to catch up to the Western powers or else risk getting stomped flat by them, which is what had happened to China, so they did a lot of imitation. Western-style dress was widely adopted among the elites of the new society, the military was recreated along Clausewitzian lines, the parliament was something of a ripoff of the Prussian one, and so on.