Officially, President Xi Jinping of China is visiting North Korea this week to strengthen “strategic communication and exchanges” between the two countries, as he wrote on Wednesday in a front-page op-ed for a North Korean state newspaper.

Unofficially, he is likely there to talk about — or at least send a message to — President Trump.

Mr. Xi arrived in Pyongyang, the capital of North Korea, on Thursday for a two-day state visit with Kim Jong-un, the country’s mysterious and mercurial leader. It is the first trip by a Chinese president to North Korea in 14 years, and only the second time a world leader has met Mr. Kim on his home turf.

The visit comes as the leaders of both countries are locked in stalled disputes with the United States, and each may be looking to the other for help gaining leverage with Mr. Trump. For Mr. Xi, the meeting is a good way of reminding the American president — with whom he is entangled in a trade war and is expected to meet at the upcoming Group of 20 meeting — that China wields valuable influence over the nuclear-capable North.