"In my short time in Washington, I've seen first-hand how the system is broken," Trump told graduates at Liberty University, an evangelical school, in Virginia where he was felicitated with an honorary law degree.
This was his first extended public appearance since firing FBI director James Comey this week.
"A small group of failed voices, who think they know everything, and understand everyone, want to tell everybody else how to live and what to do and how to think," he said.
"But you aren't going to let other people tell you what you believe, especially when you know that you are right," Trump told the graduates.
The president said "the future belongs to the dreamers, not to the critics."
"Nothing is easier or more pathetic than being a critic, because they are the people that can't get the job done," Trump said.
"But the future belongs to the dreamers, not to the critics. The future belongs to the people who follow their heart no matter what the critics say," he said in his address.
Delivering his first commencement address, Trump said in America people do not worship government, but they worship God.
"America has always been the land of dreams because America is a nation of true believers," he said.
"This is why our currency proudly declares, 'In God We Trust.' And it is why we proudly proclaim that we are one nation, under God, every time we say the Pledge of Allegiance," Trump said.
"Following your convictions means you must be willing to face criticism from those who lack the same courage to do what is right, and they know what is right but they don't have the courage or the guts or the stamina to take it and to do it," Trump said in his address.
He told graduates to "treat the word 'impossible' as nothing more than motivation" and to embrace being called an "outsider" because "It's the outsiders who change the world."
At the commencement ceremony, the Liberty University President Jerry Falwell, presented Trump with an honorary Doctorate of Laws.
"President Trump ventured into politics at a time when our nation has never been more polarised," Falwell said.
"He deserves our respect and admiration for enduring relentless and often dishonest attacks from the media, the establishment on the left and the right and from academia," he said.
(Except for the headline, this story has not been edited by NDTV staff and is published from a syndicated feed.)
Election Results for Lok Sabha Election 2019 will be out on May 23. Get the latest election news and live updates on ndtv.com/elections. Catch all the action on NDTV Live. Like us on Facebook or follow us on Twitter and Instagram for news updates from each of the 543 parliamentary seats for the election 2019