Queen Elizabeth II and the royal family welcomed Mr. Trump to Buckingham Palace with an honor guard and artillery salute, followed by lunch, afternoon tea, a tour of Westminster Abbey and a lavish state banquet, at which the president and the queen toasted each other.

The president’s four adult children arrived for the festivities, after more than a month of planning by White House officials to accommodate them and Jared Kushner, Mr. Trump’s son-in-law and senior adviser.

Before he even landed, though, Mr. Trump stoked an old feud with London’s mayor, Sadiq Khan, whom he called a “stone cold loser,” and who later called him “the poster boy for the far-right movement around the world.” And on Tuesday protesters, having prepared a statue and a blimp in Mr. Trump’s image, gathered in London’s streets to demonstrate against him, though seemingly in fewer numbers than the tens of thousands who protested his visit last year.

On Tuesday, Mr. Trump traded ceremony for diplomacy, meeting with Prime Minister Theresa May to discuss a possible trade agreement, the Chinese technology firm Huawei (which the United States has called a security threat) and other issues. He also spoke with Boris Johnson, the former foreign secretary and leading candidate to succeed Mrs. May as prime minister, and Nigel Farage, the right-wing, pro-Brexit politician whose upstart party did well in the recent European Parliament elections.

Mr. Trump has been a critic of Britain’s approach to Brexit, suggesting that it should be more aggressive in the negotiations. He took a more reserved approach on Tuesday, saying that he did not want to take a strong position. But with opponents of a withdrawal pushing for a second referendum, and the government having failed to come up with a plan that could gain Parliament’s approval, he said of Brexit, “I think it will happen.”

Maggie Haberman, Mark Landler, Alan Yuhas and Megan Specia contributed reporting.