The US pop star, best known for his viral global hit "Happy," on Sunday performed his jazzy new track at the MTV Europe Music Awards in Milan, interjecting the phrase, "Let them in!"
Elaborating a day later at a forum in New York, Williams said he did not consider himself an activist but added: "We should use our platforms where we can."
"We have to be open. And it's a tough conversation, but America is built on immigrants. We wouldn't have a country" without them, he said.
Asked if the same held true for Europe, which is facing an unprecedented influx of migrants from Syria and other troubled countries, Williams said, "Absolutely."
The 42-year-old musician spoke at length on his prolific career at an event of National Public Radio and New York University, whose Tisch School of the Arts has named him artist-in-residence.
The video for "Freedom," released in July, is subtle in its political imagery, featuring footage from around the world of places that range from an Asian sweatshop to a slum to India's holy Ganges River.
"Happy" turned into a global ode to joy as fans around the world recorded and shared their own homemade dance videos.
Williams -- for two decades a songwriter and producer for other artists including Madonna, Britney Spears and Snoop Dogg -- said he remained surprised by the massive success of "Happy."
Williams had only begun to sing himself on a large scale with French electronic duo Daft Punk's Grammy-winning 2013 album "Random Access Memories."
"In 2012, did you guys see me as an artist?" Williams asked the audience. "I never have, this whole time."
"I still consider myself a producer," said Williams, who looked visibly uncomfortable as the moderator played his earlier music.
Williams said that he aspired not to become a bigger pop star but to be a major producer in the model of Quincy Jones or Dr. Dre.
Despite his stated reluctance at activism, Williams earlier this year spoke at the United Nations to encourage action against climate change.
Williams told the New York event that he was supporting Hillary Clinton in her presidential bid, believing it was time for a woman to lead the United States.