For months, Xi has put off visiting North Korea, he does so now knowing that the timing is right and he stands to gain a lot more.
First of all China is concerned about the current diplomatic deadlock between North Korea and the United States. It is in their best interests, and the interests of the wider region, to get those talks back on track.
After the failed US-NK summit in Hanoi and the subsequent cold shoulder being given to South Korea, China, as North Korea's biggest trading partner and most important ally, is best-placed to reignite the stalled diplomatic process.
President Xi can paint himself as a powerful mediator, a bridge builder. By affording Kim Jong Un the prestige of a visit he can try to bring him on board with a plan that would get him back round the table with Trump and draw from him, in person, what it is going to take to get him to agree to, at minimum, a freeze of his nuclear programme.
If President Xi can do that, then he will then be able to travel to the G20 summit in Japan next week and meet with President Trump for their crunch trade talks, with a sweetener in his pocket.
Having just launched his re-election campaign this week Trump would like nothing more than to “solve” the North Korea nuclear problem before next years US Elections. He sees it as legacy-forming. We could therefore see President Xi using his influence with Kim Jong Un to entice President Trump into a trade deal. Win win.
But none of that will be on display when the pictures of Xi Jinping's visit are released. We will be told that the two leaders are celebrating 70 years of diplomatic relations between the two countries. The reality is that there is a deep mistrust between the two men, there is likely to be little chemistry.
But Xi Jinping is not only the first Chinese President to visit Pyongyang in 14 years, he is the first to visit a nuclear-capable North Korea. So both men, with their own country’s best interest a priority will seek to use one another.
President Xi potentially bringing Kim back to the negotiating table and in the process getting a good trade deal with the United States, and Kim Jong Un at the same time using China to get he wants - a deal with President Trump.
The people of North Korea will be presented with reports of their leader as a foreign policy mastermind