After WWII, in 1945 Korea was divided into two zones of ocuppation. It was divided at the 38th parallel.
In 1948, rival governments were established. The republic of Korea in the South, controlled America, with capitalism, While the North was controlled by the Soviet union with communism.
In June 25, of 1950 North Korea made a surprise attack and invaded South Korea corssing the 38th parallel. They captured Seoul, South Korea's capital and took almost over all South Korea. Thats when the war started.
In June 27, U.S. President Truman authorized the use of American resources in Korea; a week later, the United Nations sent troops to aid under U.S. command, and Truman appointed General Douglas MacArthur supreme commander. Mac arthur had a startegy to march into North Korea and they nearly reached the Yalu river.
Anyway the war continue and lasted for three years, when they stop fighting in one side and stay in the 38th parallel, MacArthur, wanted to mount another invasion of North Korea. MacArthur continued publicly criticizing U.S. policy, so Truman removed him from command on Apr 1951.
Negotiations broke down four different times, but after united nations helped and also an armistice agreement was signed on July 27, 1953, they created a neutral zone called demilitarized zone to separate the countries and the war come to an end.