This article is more than
6 year oldRumours circulated earlier this week after local media reported a high-profile figure had arrived on a special train.
The visit, confirmed by China and North Korea, was Mr Kim's first foreign trip since taking office in 2011.
Mr Kim held "successful talks" with the Chinese leader Xi Jinping in Beijing, Xinhua reports.
The visit is considered a significant step in North Korea's preparation for talks agreed in principle with South Korea and the United States.
Last month, President Donald Trump accepted an unprecedented invitation to meet Mr Kim.
Analysts had said North Korean and Chinese leaders would be likely to meet before that summit goes ahead. China is North Korea's main economic ally.
Xinhua said Mr Kim had assured his Chinese counterpart he is committed to denuclearisation.
North Korea's KCNA news agency called the visit "a milestone" in improving ties with China.