Trump's comments on Twitter came a day after Kelly told Democratic lawmakers that some of the hard-line immigration policies Trump advocated during the campaign were "uninformed," that the United States will never construct a wall along its entire southern border and that Mexico will never pay for it, according to people familiar with the meeting.
Later Wednesday, Kelly confirmed his comments during a television interview but attempted to play down differences with the president while describing him as a willing negotiator as a government shutdown looms.
"He has evolved in the way he looks at things," Kelly told Fox News. "Campaign to governing are two different things, and this president has been very flexible in terms of what's in the realm of the possible."
Trump had only positive things to say about Kelly when talking to reporters Thursday, but several Trump associates said the president was furious with his chief of staff both for what he said and for the tone he used, which Trump thought made it appear he was a child who had to be managed.
One Trump associate who spoke to the president Wednesday night said Trump thought Kelly's comments made him look bad and like he was giving in to Democrats.
The president, this person said, particularly disliked the word "uninformed" that appeared in news reports and has chafed for weeks at the characterization of himself as not intelligent and flighty in the best-selling book about his presidency by Michael Wolff.
The person, who spoke on the condition of anonymity to talk more candidly, said it was "inevitable" for Trump to be angry with his chief of staff and that it was surprising that it hadn't happened before.
It was a positive sign for Kelly, the person said, that Trump didn't mention the chief of staff's name explicitly in the tweet. There seems to be no effort afoot to make a change in the chief of staff position, the person said.
Christopher Ruddy, a Trump friend and president of the conservative media outlet Newsmax, agreed with that assessment, although he said he has not spoken with the president since Kelly made his remarks.
"The president is pretty happy with his job overall," Ruddy said of Kelly. "Trump's the type of guy who will dress you down if he doesn't like what you say, but it's got to be a whole long list of things before he takes action against somebody. Generally, in my personal view, he's very happy with General Kelly, overall."
Speaking to reporters ahead of an event Thursday afternoon in Coraopolis, Pa., Trump praised Kelly, who spent part of the afternoon representing the White House in meetings with lawmakers on Capitol Hill.
"He is great, I think he is doing a great job," Trump aid. "I think General Kelly is doing a really great job. He is a very special guy."
Trump disputed that Kelly had told Congress that Trump's views on immigration were not fully formed during the campaign.
"No, he did not say that," Trump said. "He didn't say it the way you would like him to say it."
White House spokesman Raj Shah said Trump was frustrated by the media coverage of Kelly's comments.
"His only frustration is with the media," Shah said. "They have a great relationship, and that continues."
Trump and Kelly spoke Thursday at the White House before the Pennsylvania trip and talked through the chief of staff's comments, with Kelly explaining what he said and offering further context, according to two people familiar with the exchange. The meeting ended amicably and Trump was in a good mood as he departed the White House, said the people, who spoke on the condition of anonymity because they were not authorized to talk about the exchange.
Another person close to Trump said he asked Kelly why he would go on television and criticize him. This person said Kelly tried to explain to the president that he wasn't criticizing him and was just explaining his position, but Trump wasn't hearing it.
One top Republican who has friends inside the White House said Thursday that Kelly could still be on "thin ice" with Trump.
"He used to call [former chief of staff] Reince Priebus a very special guy, and then he was fired, so you can't take what he says as a guarantee that all is well inside the White House," the Republican said.
A second Republican with ties to the White House added: "This kind of thing isn't that different than how everything runs every day. The president will hear or see something and then either get told that it was taken out of context and move on or grow even angrier about whatever it is."
Both Republicans spoke on the condition of anonymity to offer a more candid assessment.
Ruddy said Kelly may have struck a nerve by speaking out on immigration, in particular.
"In President Trump's world, you can have disagreements privately or publicly, but immigration is a hot-button issue for him, and it's something he doesn't like to see disagreements on, especially publicly," Ruddy said. "He knows how important it is to his base."
Another Trump associate familiar with the president's reaction to Kelly said his rage was similar to his response in summer 2016 when Paul Manafort, then his chief strategist, told a Republican National Committee meeting in Florida that Trump had been playing a "part" on the campaign trail but was starting to pivot toward presenting a more businesslike and presidential "persona."
"Kelly thinks he knows what policies are important and what aren't, but Donald Trump is the president of the United States," said the associate, who also spoke on the condition of anonymity to talk more candidly.
In another tweet Thursday morning, Trump insisted Mexico would pay for the border wall.
"The Wall will be paid for, directly or indirectly, or through longer term reimbursement, by Mexico, which has a ridiculous $71 billion dollar trade surplus with the U.S.," Trump said. "The $20 billion dollar Wall is 'peanuts' compared to what Mexico makes from the U.S. NAFTA is a bad joke!"
Kelly's original comments came during a closed-door session at the Capitol on Wednesday with members of the Congressional Hispanic Caucus and House Minority Whip Steny H. Hoyer (D-Md.). Kelly repeatedly said that Trump supports enacting permanent legal protections for "dreamers," people brought to the country illegally as children or who overstayed their visas as children, and that he has helped the president evolve on immigration policy, according to people there.
After the meeting, Rep. Luis V. Gutiérrez (D-Ill.), one of the participants, put out a statement that Kelly said Trump's views were "not fully informed."
"A concrete wall from sea to shining sea" is not going to happen, Kelly said, according to attendees. Instead, "a physical barrier in many places" is what the administration is requesting. Kelly used the term "physical barrier" several times during the meeting, attendees said.
A "concrete wall is not a realistic solution in many places," Kelly said — noting that topography, among other issues, makes building a physical wall difficult along certain parts of the more than 2,100 miles between the United States and Mexico.
Instead, "we need 700 more miles of barrier," Kelly said — a concession that a physical barrier does not need to stretch the entire length of the border.
A "concrete wall would be good in only certain places," he added, saying manpower and drone technology should suffice in others.
Kelly also said that there will be no wall "that Mexico will pay for."
Later in the Fox interview, Kelly confirmed that the administration is seeking 700 miles of new wall and reiterated Trump's view that the United States would be able to use a renegotiation of NAFTA to get Mexico to fund the wall.
"In one way or another, it's possible that we could get the revenue from Mexico, but not directly from their government," he said.
Ed O'Keefe and Philip Rucker contributed to this report.