Japan had annexed Korea in 1910 and ruled it until the end of WWII. When Japan lost the war, Korea (like Germany) would be divided into two areas.
At the July-August 1945 Potsdam Conference (where Truman, Stalin, Churchill and Atlee discussed how various territories would be split up and operate at the end of the war in the Pacific), the three powers agreed Korea would be divided roughly in half - at the 38th Parallel. The Soviet Union, and its allies, would operate in the North while the US, and its allies, would operate in the South.
In August, 1947, China, Great Britain and the US recommended a plan to reunify the country, but the Soviet Union (still under Stalin’s control) refused to cooperate. National elections, supervised by the United Nations, took place in May of 1948, but the North Koreans neither took part in, nor recognized the results of, the election. The South Koreans chose representatives for the National Assembly of the new Republic of Korea. By July of 1948, the country had a new constitution and the United States Army Forces in Korea ceased to have any governmental authority in the country.
North Korea, meanwhile, formed its own government: The Democratic People’s Republic of Korea. Kim Il Sung was its leader and his government claimed jurisdiction over the entire Korean Peninsula (including the South).