The relationship between the North and its key protector has soured in recent years, with China increasingly exasperated by its neighbour's nuclear antics and recently showing a new willingness to enforce United Nations sanctions imposed on it over its weapons and missiles programmes.
But KCNA quoted Kim as saying at a banquet in Beijing: "There is no question that my first foreign visit is to the Chinese capital.
"This is my solemn duty as someone who should value and continue the DPRK-PRC relations through generations," he added, using the countries' official acronyms.
The North's leader invited Xi to make an official visit to Pyongyang "at a convenient time and the invitation was accepted with pleasure", KCNA added.
Such a trip by a current Chinese Communist Party general secretary and national president would be extremely unusual.
In his speech Kim said the North Korean and Chinese peoples have "sacrificed lives and shed blood in their common struggles for decades, have experienced that their lives are inseparable, and realise how important regional peace and stability is for these two neighbours separated only by a river".
He pledged to "strengthen and elevate" the relationship between the two countries, calling it "a noble heritage passed on by past predecessors".
Kim was accompanied by his wife Ri Sol Ju and several officials and dignitaries, KCNA said, without mentioning his sister Kim Yo Jong, who acted as his special envoy to last month's Winter Olympics in the South, which triggered an unprecedented flurry of diplomatic activity focused on the flashpoint peninsula.
(Except for the headline, this story has not been edited by NDTV staff and is published from a syndicated feed.)