The reason that Kim Jong Un met with the Chinese in Beijing before he met with the South Koreans and the United States is that he was looking for advice and counsel by their biggest ally. China has a strong international voice and Un went to China first to show that the North Koreans were serious about wanting to get sanctions lifted and brining the country into a more acceptable status among the international community. China has also become one of the countries who were questioning the aim and direction of the nuclear weapons program in North Korea.
Un also wanted to get assurance from China that they would still have backing if any agreements were to fall through. The most important reason for this meeting in China was to let the Chinese know that North Korea was serious about ending their nuclear weapons program. They wanted to let them know first so that the international community would get a better impression of North Korea and their true intentions of ending their nuclear program.