In a defiant address, Mr Trump told the Asia-Pacific Economic Co-operation (Apec) meeting that the US would no longer tolerate “chronic trade abuses”.
In contrast, President Xi said globalisation was irreversible.
Mr Trump is currently on a five-nation Asia tour, with China one of his stops.
Apec brings together 21 economies from the Pacific region – the equivalent of about 60% of the world’s GDP.
Since taking office, President Trump has pursued his “America First” agenda and pulled the US out of the regional Trans-Pacific Partnership – a major trade deal with 12 Apec nations – arguing it would hurt US economic interests.
In a speech in the Vietnamese port city of Da Nang on Friday, President Trump railed against the World Trade Organization, which sets global trade laws, and said it “cannot function properly” if all members do not respect the rules.
He complained about trade imbalances, saying the US had lowered market barriers and ended tariffs while other countries had not reciprocated. “Such practices hurt many people in our country,” he said, adding that free trade had cost millions of American jobs.
But he did not lay the blame on Apec countries, and instead accused earlier US administrations of not acting earlier to reverse the trend.
He said America would make bilateral agreements with “any Indo-Pacific partner here who abides by fair reciprocal trade”, but only “on a basis of mutual respect and mutual benefit”.
Mr Trump has repeatedly referred to the region as “Indo-Pacific”, a term used to define America’s new geopolitical view of Asia.
The US president had travelled to Da Nang from Beijing, where he had also discussed America’s huge trade imbalance with China. There too, he said he did not blame the country for “taking advantage”.
Mr Trump also met Russian President Vladimir Putin at the summit. The two shook hands and exchanged a few words, Russian news agencies reported.
Speaking minutes after his American counterpart, Chinese President Xi Jinping took to the podium to espouse his country’s credentials as the new champion of world trade.
Globalisation, he said, was an “irreversible historical trend” but the philosophy behind free trade needed to be repurposed to be “more open, more balanced, more equitable and more beneficial to all”.
In contrast to President Trump, the Chinese leader defended multilateral trade deals, which he said helped poorer nations to benefit.
“We should support the multilateral trading regime and practise open regionalism to allow developing members to benefit more from international trade and investment.” (Courtesy BBC)