His departure is the latest in a string of them since Mr. Kelly, a retired Marine general, took over as the White House chief of staff last month. Mr. Gorka criticized Rex W. Tillerson, the secretary of state, in a public show of disrespect that chafed Mr. Kelly’s sense of order, according to one senior administration official.
Mr. Gorka also said that in fighting terrorism, white supremacists should not be a concern. He made the remarks shortly before the racially charged violence in Charlottesville, Va., in which a man who was said to admire Adolf Hitler rammed his car into counterprotesters and left a woman dead.
Efforts to reach Mr. Gorka on Friday night were not immediately successful.
Mr. Gorka, who described himself as a national security adviser to the president but who existed outside the National Security Council and had no clear duties, was a divisive figure while in the White House. He memorably declared that “the alpha males are back” as an assertion of the distance between the Obama administration and the current one.
He has also been a vocal defender of the Trump administration’s efforts to temporarily ban travel from some predominantly Muslim countries; he has said violence is a fundamental part of Islam and emanates from the language of the Quran. His hard-line views on Islam have prompted his critics to accuse him of Islamophobia.
Mr. Gorka, 46, has also been accused of having links to far-right groups in Europe. He is a former editor at Breitbart News, a right-wing website, and a friend of Stephen K. Bannon. Mr. Bannon, who was until last week Mr. Trump’s chief strategist, has since returned to Breitbart News as executive chairman.
An American citizen who was born in Britain to Hungarian parents, Mr. Gorka made a habit of assailing the news media for its coverage of Mr. Trump, insisting that reports of turmoil in the White House had “almost no resemblance to reality.”
Mr. Gorka earned a Ph.D. in political science from Corvinus University of Budapest and had made his living as a national security expert with a focus on Islamist extremism. He wrote a best-selling book, published last year, called “Defeating Jihad: The Winnable War.”
Mr. Gorka was not particularly well known to Washington policy makers before his appointment in January. But he has been connected with the Trump campaign since at least 2015. Federal election commission filings indicate that the Trump campaign paid $8,000 to Mr. Gorka for policy consulting that year.