NUSA DUA, Indonesia—A senior U.S. official said China is uncomfortable with Russia’s rhetoric and invasion of Ukraine, as President Biden and Chinese leader Xi Jinping prepared for a meeting aimed at dialing down tensions between Washington and Beijing.

“I think there is undeniably a discomfort in Beijing about what we’ve seen in terms of reckless rhetoric and activity on the part of Russia,” the U.S. official said in a briefing with reporters on Monday. “I think it is also undeniable that China is probably both surprised and a little bit embarrassed by the conduct of Russian military operations.”

The U.S. official, who declined to be identified, was characterizing comments Chinese Premier Li Keqiang made to world leaders during a closed-door summit in Cambodia over the weekend. While noting that Beijing and Moscow have significant economic ties, the U.S. official, who attended the meeting, said Mr. Li “spoke rather extensively about Chinese policy toward Ukraine with clear emphasis on sovereignty, on the irresponsibility of nuclear threats, on the need to ensure that nuclear weapons are not used in the way that some have suggested.”

China’s Foreign Ministry and the Kremlin didn’t immediately respond to requests for comment.

China, however, said last week that its relations with Moscow are built on a high degree of mutual trust. “China’s relations with Russia are rock-solid,” Chinese foreign ministry spokesman Zhao Lijian said at a regular news conference on Friday. “China will continue to work with Russia to move forward bilateral relations on a right and steady track.”

Mr. Li, who was Beijing’s most senior representative at the summit hosted by the 10-member Association of Southeast Asian Nations, offered a veiled rebuke of Moscow’s threats to employ nuclear weapons, according to people who attended the weekend meeting in Cambodia. Mr. Li said that no country should use or threaten to use nuclear weapons, and that humanity should learn from history, the people said. Mr. Li’s comments, which didn’t explicitly name Russia, echoed earlier remarks by Japanese Prime Minister Fumio Kishida, who mentioned the U.S. atomic bombings of Japan during World War II.

Though China has underscored its ties to Russia, officials in Beijing have begun to express discomfort with the war. At a meeting between Mr. Xi and Russian President Vladimir Putin in September, the Russian leader said he would seek to address Beijing’s concerns about the Ukraine war, without specifying what those concerns were.

In September, Mr. Putin signaled he would consider using nuclear weapons in the war in Ukraine, escalating tensions and raising objections from countries around the world. Earlier this month, during talks between Mr. Xi and German Chancellor Olaf Scholz in Beijing, China warned Russia against threatening to use nuclear weapons in the conflict in Ukraine.

U.S. officials said they expect Mr. Biden to raise the issue of Russia’s actions in Ukraine during Monday’s bilateral meeting and they hope Mr. Xi will reiterate his opposition to the use of nuclear weapons.

China’s Foreign Minister Wang Yi is expected to meet with his Russian counterpart Sergei Lavrov in Bali while both are attending the G-20 summit, according to a person familiar with the agenda.

Keith Zhai contributed to this article.

Write to Andrew Restuccia at andrew.restuccia@wsj.com and Chun Han Wong at chunhan.wong@wsj.com