BEIJING — Amid the pomp that President Xi Jinping of China is bestowing upon his visiting American counterpart, President Trump, it’s hard not to see two leaders — and two countries — heading in very different directions.

Mr. Xi emerged from last month’s Communist Party Congress the undisputed master of the Middle Kingdom. “Xi Jinping Thought” was enshrined in the party constitution — an honor previously granted only to Mao Zedong and Deng Xiaoping. Breaking with precedent, Mr. Xi neglected to anoint a successor — a big hint that he feels emboldened to extend his rule beyond the second five-year term he has just begun. The Economist heralded Mr. Xi with an honorific usually reserved for America’s president: the world’s most powerful man.

Mr. Trump stepped off Air Force One in Beijing on Wednesday with historically low job-approval ratings, just hours after suffering a shellacking in off-year elections. His credibility is cratering abroad — polls have shown a drop in confidence in American leadership.

As the personal trajectories of Mr. Trump and Mr. Xi diverge, so too does the focus of their leadership. While Mr. Trump is obsessed with building walls, Mr. Xi is busy building bridges.