“Someday you won’t be saying that,” the president said, in what for him was a grandfatherly tone.

Mr. Trump and Mr. Kurz later discussed trade tensions between the United States and Europe, as the White House nears a decision to impose tariffs on German automobiles. Austria is a producer of car parts, and Mr. Kurz has proposed himself as an intermediary between Mr. Trump and Ms. Merkel, whose relationship — never warm — has hardened.

“The conversation was tough,” said Martin Engelberg, a senior aide to Mr. Kurz, who noted that Mr. Trump also pressed his guest on Austria’s reliance on natural gas from Russia. Mr. Engelberg said the two leaders did not discuss immigration, and he rejected the suggestion that cultivating Mr. Kurz was a way for Mr. Trump to divide the European Union. “The chancellor is absolutely a committed European,” he said.

As the leader of a country with fewer than nine million people, however, Mr. Kurz can do little to head off a trans-Atlantic trade war. Mr. Trump’s decision to meet with him was mostly about what Mr. Kurz symbolizes in a Europe with which the president has had an increasingly antagonistic relationship.

“For better or for worse, he is the chancellor of a German-speaking country that is in a coalition with the hard right,” said Constanze Stelzenmüller, an expert on Europe at the Brookings Institution. “They might see Kurz as a normalizer of the right.”

Shortly after he arrived in Germany, Mr. Grenell enraged his hosts by telling Breitbart News that he wanted to encourage a new generation of conservative leaders in Europe — an obvious dig at Ms. Merkel. He singled out Mr. Kurz, a native of Vienna who rose up in the center-right People’s Party before seizing on the issue of Muslim immigration to carve out a sharper identity and appeal to nativist sentiments.

“He was swept up in the wake of the migration crisis,” said Eugen Freund, a member of the European Parliament from Austria. “If there hadn’t been a migrant crisis, there wouldn’t have been a Sebastian Kurz.”

Mr. Freund, a former broadcaster who is a Social Democrat, said there were important differences between Mr. Kurz and Mr. Trump, aside from their age. The president is freewheeling and blunt; the chancellor chooses his words carefully. The president vilifies the news media; the chancellor has cultivated journalists in Austria, earning positive coverage.