In March 2019, Xi Jinping flew to Paris to meet French President Emmanuel Macron, German Chancellor Angela Merkel and the then-president of the European Commission, Jean-Claude Juncker.

After toasting with flutes of Champagne, the Chinese president pressed the three leaders, according to an official present. A recent European Union policy paper had described China as a “systemic rival.” Did the Europeans really mean it?

Ms. Merkel demurred with a compliment for Mr. Xi, saying the language showed Europe recognized China’s growing strength and influence, the official said. Mr. Juncker cut the tension with a joke about the EU’s inability to agree on what China was. But Mr. Macron was blunt, the official recalled.

It’s true, the French president said. You are a rival.

A few weeks later, France sent a warship through the Taiwan Strait, provoking Beijing, which accused the frigate of illegally entering Chinese waters.

Inside China, Mr. Xi’s authority is increasingly seen as absolute. He has sidelined rivals, silenced dissidents and bolstered his popularity by promoting a resurgent China unafraid to assert its interests.

The biggest challenge to his vision for China comes not from within its borders but from other parts of the world, in nations whose views of Beijing have dramatically changed in just a few years.

Countries that once avoided upsetting Beijing are moving closer to Washington’s harder and largely bipartisan stance—to curb Chinese access to customers, technology and sensitive infrastructure.