Obama, who was speaking in Ottawa, Canada, at a North American leaders' summit was asked if he discussed Trump's "anti-immigrant and anti-Mexican rhetoric" during his meetings with Mexican President Enrique Peña Nieto and Canadian Prime Minister Justin Trudeau.
"We've had times throughout our history where anti-immigration sentiment is exploited by demagogues," he said at a news conference. "The language is identical. But guess what? They kept coming, and they kept coming because America offered possibility for their children and grandchildren."
Obama added, "America is a nation of immigrants. That's our strength. Unless you are a Native American, somebody, somewhere in your past showed up from someplace else, and they didn't always have papers."
"And the genius of America has been to define ourselves not by what we look like or what our last name is or our faith but our adherence to a common creed," he added.
The President took a swipe at Trump's populist message -- though he didn't mention the candidate by name -- by questioning how the real estate mogul had ever worked to improve the lives of working Americans.
"Somebody else, who has never shown any regard for workers, has never fought on behalf of social justice issues ... they don't suddenly become a populist because they say something controversial in order to win votes," Obama said. "That's not a measure of populism. That's nativism, or xenophobia, or worse. Or it's just cynicism."
"Let's just be clear that somebody who labels us versus them, or engaged in rhetoric about how we're going to look after ourselves, or take it to the other guy, that's not the definition of populism," Obama added. "Sorry."
Obama has increasingly criticized Trump in recent public remarks.
"Isolating or disparaging Muslims, suggesting that they should be treated differently when it comes to entering this country, that is not just a betrayal of our values. That's not just a betrayal of who we are -- it would alienate the very communities at home and abroad who are our most important partners in the fight against extremism," Obama said
in May while delivering the commencement address at Rutgers University.
And earlier this month
, Obama lit into Trump over the billionaire's calls for tough action in the fight against terrorism, particularly his ban on Muslims from entering the U.S.
"That's not the America we want," he said. "It doesn't reflect our democratic ideals. It will make us less safe."