The primary reason for the Japanese attempt to invade Korea in the late sixteenth century was land acquisition. Toyotomi Hideyoshi recognized the opportunity in front of him. He understood that invading Korea in the hopes of acquiring it would be the only approach Japan could take to sustain their strength in the region.
Hideyoshi spent considerable time and energy unifying Japan. Prior to Hideyoshi's attempts, Japan had been fragmented. Centralized administration in Japan was impossible to achieve. With a unified Japan, Hideyoshi understood that he could pivot to focus on Japan's security in the region. Fearing the power of the Ming Dynasty in China, he sought a foreign policy directive that used Korea as a potential buffer between Japan and China, or even convert a conquest of Korea into a potential invasion of China. Hideyoshi had an advanced understanding of warfare and tactics. His use of firepower as weapons and employment of samurai soldiers as part of his invading fleet represents this. Given how he perceived his own advantage, being able to acquire Korea was seen as a plausible reality and thus something to be undertaken.
The desire for land merged with the desire for Japanese security. The act of attempting to invade Korea was offensively- driven, in nature. Some suggest that Hideyoshi sought to strengthen Japanese position in the region, and saw the need to invade and capture Korea as being essential. Others argue that Hideyoshi feared the massive Ming Dynasty. Being able to pose a threat to them required Japanese control of Korea. Hideyoshi was able to bring together previously disparate parts of Japan in order to see a common goal or enemy. Hideyoshi recognized this unique instant in Japanese history and sensed that it could be translated into greater gain. Accordingly, the seizure of Korea was sought. It became the political representation of Hideyoshi's political goals. The fact it ends in stalemate represented how formidable a challenge it actually was and the strength of the Ming Dynasty, who entered the conflict on the Korean side to push back the Japanese into a stalemate.