"The FBI that I see is tens of thousands of fearless men and women working as hard as they can to keep people they will never know safe from harm". "We're accustomed to that", he said.
Wray sought to fend off the attacks on the agency by expressing pride in the agents, analysts and other personnel who he said were working to protect Americans.
Mr Wray conceded that agents do make mistakes and said there are processes in place to hold them accountable.
Trump also retweeted reports that a top FBI investigator on special counsel Robert Mueller's team was removed from the investigation for exchanging text messages that could be construed as anti-Trump.
Democrats pushed Mr Wray to respond forcefully, while Republicans echoed Mr Trump in suggesting they worry about political bias in special counsel Robert Mueller's probe of possible Trump campaign ties to Russian Federation during the 2016 presidential election.
"After years of" former FBI Director James "Comey, with the phony and dishonest Clinton investigation (and more), running the FBI, its reputation is in Tatters - worst in History!" Those investigations have transformed routine oversight hearings, like the one Thursday, into platforms for tense questions about the political leanings of an agency that prides itself on being removed from partisan consideration.
Wray was pressed on Trump's tweet during a hearing before the House Judiciary Committee.
"The depths of this anti-Trump bias on the Mueller team just goes on and on", said Rep. Chabot.
"Your responsibility is not only to defend the bureau but to push back against the president when he is so clearly wrong, both on the facts and as a matter of principle", Mr Nadler told Mr Wray. Since he was sworn in on August 2, the USA has experienced two of the deadliest shootings in its modern history and an attack on a bike path in Manhattan that officials have said was terrorism.
Wray became the director four months ago after Comey was sacked by Trump, and the new director has tried to keep a low profile and steer the agency clear of the public fights surrounding Trump, Clinton and Comey. With his bosses, Attorney General Jeff Sessions and Sessions' deputy, Rod Rosenstein, staying publicly silent, it fell to Wray to defend the agency.
"I think these matters are being looked at as they should be by somebody outside the FBI and when those findings come to me I will take appropriate action if necessary", Wray said, referencing the ongoing inspector general investigation.
Just this week, we learned how Federal Bureau of Investigation agent Peter Strzok softened language from "gross negligence" to "extremely careless" in terms of concluding how Clinton handled national security information on her private server.