The same way that other countries divide and may call themselves by different names or become different countries: different beliefs, different wishes for the way the country is run, different leaders promulgating different ideas and ideals. Often this is religious difference.
The same has happened, very bloodily, in Ireland over many generations. In the case of Korea, it was split to serve the purposes of entirely different countries: China and the United States after the Cold War. North Korea invaded South and the U.S intervened to protect their patch. It is recognised now how harmful this was to all concerned.
The Korean civil war began in June of 1950 when the North Korean army attacked South Korea by crossing the 38th parallel, the artificial dividing line that separated the north from the south. North Korea claimed they were attacking in response to an attack by South Korea. However most historians agree this was probably a lie and was actually a premeditated offensive with the backing and approval of Russia.
Some speculate Russia wanted all of Korea because the US had “all” of Japan. Others speculate Russia didn’t want a US base so close to their territory, that they wanted to frighten and embarrass the US, and/or Russia believed the US had little interest in South Korea and would likely not put up much of a fight in support of South Korea. Who really knows for sure?