But the Trump family trusted her, and that was a crucial factor in her emergence as a key aide to the president, who also valued her loyalty.

Yet as the person who spent the most time with Mr. Trump, Ms. Hicks became enmeshed in a number of controversies over the past year, including key aspects of the investigations by Congress and the special counsel, Robert S. Mueller III, into possible collusion between the Russian government and the Trump campaign, as well as the firing of the F.B.I. director, James B. Comey.

In recent weeks, her personal life drew unwanted attention when it was reported that she had dated Rob Porter, the White House staff secretary who resigned under pressure over allegations that he had abused his two former wives.

Multiple White House aides said Ms. Hicks’s decision to leave was unrelated to her appearance before the House committee. They said she had told a small group of people in the days before the session that she had planned to resign, partly because she never liked Washington and chose not to try to pretend to.

Ms. Hicks’s departure will coincide with those of other people who have been close to the Trump family members in the White House. Reed Cordish, a policy adviser and friend of Jared Kushner and Ms. Trump, is leaving his role; Josh Raffel, a press aide whose initial portfolio was primarily focused on Mr. Kushner and Ms. Trump, is also leaving; and Dina Powell, who had been a deputy national security adviser who was close to Mr. Kushner and Ms. Trump, left weeks ago.

Their absence will deprive Mr. Trump and his daughter and son-in-law of many of the aides who served as crucial buffers and sounding boards as a turbulent and politically uncertain year begins.

Among the things Ms. Hicks had advised Mr. Trump, according to multiple White House officials, was to tone down some of his Twitter posts or stop sending them altogether, an effort that had mixed results. She also had the ability to stop Mr. Trump from focusing on an issue he was angry about, and sometimes shield other members of the staff from Mr. Trump’s anger.