BANGKOK — The president of the Philippines, Rodrigo Duterte, seldom holds back.

His antidrug crusade has led to the extrajudicial killings of thousands of people. He is fond of boasting about how he has personally killed criminals and even strangers. He unleashes profane diatribes about countries and world figures he dislikes, with the United States often on the receiving end.

But more quietly, he seems to have warmed to the United States and President Trump, who also has a notably provocative style.

As his country hosted a summit meeting of the Association of Southeast Asian Nations, or Asean, on Sunday, the more charming side of Mr. Duterte’s personality was on display, both in his meetings with Mr. Trump and in his foreign policy goal of closer relations with China.

One big reason for his shift in rhetoric when it comes to the United States is clear: President Trump is a marked improvement in Mr. Duterte’s eyes over Barack Obama, who urged the Philippine leader to follow the rule of law in tackling the illegal drug trade.