Mr. Trump on Sunday accused Mr. Fallon of “whimpering” and told him to “be a man.”

“@jimmyfallon is now whimpering to all that he did the famous ‘hair show’ with me (where he seriously messed up my hair), & that he would have now done it differently because it is said to have “humanized” me — he is taking heat,” the president tweeted. “He called & said ‘monster ratings.’ Be a man Jimmy!”

About three hours later, Mr. Fallon responded by saying he would donate to the nonprofit group, known as Raices. He did not disclose how much he would donate.