Korea wasn't always divided into North and South like it is now. While today the differences between the two seem as distinct as night and day, just 75 years ago they were essentially the same nation. Why then, is Korea divided into two countries?
The history of North and South Korea is complicated. The country was split in two after WWII, but the story really goes back to a time long before that. The history of the Korean Peninsula is a tale of a small kingdom being pushed around by much larger powers again and again. The split between the North and the South is just the latest manifestation of that phenomenon.
For nearly 5 centuries, the Korean Peninsula was ruled by the Joseon Dynasty with varying degrees of authority. The Joseon Dynasty arose after many years of decline on the part of the 400-year-old Goryeo Dynasty and a few years of nominal Mongol occupation. Long story short, an ambitious general named Yi Seong-gye staged a coup, and - after a few years of puppet rule - installed himself as the new King. Going by the moniker King Taejo, he moved the capital to Seoul (then Hanseong).
The Joseon Dynasty's power wasn't always absolute over their 500-year reign, however. In 1401, it became a tributary of Ming China. In 1592 and 1597, Japan invaded, but they didn't stay around long. In 1637, the Joseon lost a war with the newly established Qing Dynasty in China and was forced again to become their tributary.
By the end of the 19th century, the Joseon Dynasty was in decline. Both the Donghak peasant rebellion and increasingly untenable isolationist policies left the central government weak. At this point, both Chinese and Japanese forces increased their presence in Korea, leading to the First Sino-Japanese War (fought mainly on Korean soil). After Qing China's defeat at the hands of Japan in 1895, Korea then became a tributary of Japan.
Nominal Japanese rule over Korea actually began after the First Sino-Japanese War in 1895, when Korea essentially changed from a tributary of Qing China to a tributary of Japan. From the start, the Japanese systematically imposed rule on the declining Joseon Dynasty. This culminated in the Japan-Korea Annexation Treaty of 1910, in which the Emperor of Korea formally ceded all authority to the Emperor of Japan... though he refused to sign it himself and instead sent an ambassador to Japan on his behalf.
For the first 10 years, Japan imposed harsh military rule on the new colony. In 1919, a nationwide protest demanding independence was met with overwhelming force. Different estimates place the number of protesters killed at between 553 and 7,509. After the incident, the Japanese revised and somewhat relaxed their policy of rule. Korea was rapidly modernized and industrialized in order to provide Japan with goods and resources to fuel their expansionism.
During the latter part of the 1930s, as Japan mobilized for war, conditions again became harsh. The Japanese decided to try to assimilate the Koreans, teaching school in Japanese. Koreans were made to adopt Japanese names, and after 1938, schoolchildren were actually forbidden to speak Korean. Efforts were made to eradicate native Korean culture, and Shinto was introduced, but it didn't take.
After Japan's defeat in WWII, the question remained as to what to do with Japan's former territories. The US had already taken many of Japan's island holdings, and, in the last days of the war, the Soviet Union had overrun much of Japan's territory in Manchurian China.
Worried that the Soviet Union would soon dominate the whole of Korea as well, the US proposed splitting it into two zones. Days before the war closed, the two nations agreed to split control of postwar Korea along the 38th parallel, putting Seoul in the American half. The idea, of course, was to later unify it under a newly established government.
Initially, the idea was to unify Korea under one government when it was split in the wake of WWII. However, the occupying US and Soviet forces couldn't agree if said government would be capitalist and democratic or communist. Notably, Korea had never been either before, only having experience as a caste-based monarchy and a subservient colony, respectively.
To solve the impasse, the US basically set up anti-communist Syngman Rhee as the President of the Republic of Korea with United Nations sanctioned elections in August. In September, the Soviet Union set up former Soviet Red Army Major Kim Il-sung as the Premier of the Democratic People’s Republic of Korea (in the Stalinist, "cult-of-personality" model). Each of the two governments claimed sovereignty over the whole of the Korean Peninsula.