After weeks of criticism from fellow Democrats about her approach to a barrage of insults from Donald J. Trump, Hillary Clinton drastically changed course on Thursday: Instead of staying above the fray, she took the fight to Mr. Trump.

In a speech in San Diego that was billed as a policy address, Mrs. Clinton instead sought to frame the stakes of an election against Mr. Trump, and she pulled no punches. In contrast with most of Mr. Trump’s aides, she called him by his first name. She insinuated that he was mentally instable. And she mocked his frequent use of Twitter.

The attack appeared to get under Mr. Trump’s skin, despite his protestations to the contrary. At a rally in California on Thursday night, he said Mrs. Clinton was both sycophantic to President Obama and despising of him, a line of attack that aligns with that of Edward Klein, a conservative author whose books on Mrs. Clinton and Mr. Obama have been dismissed by critics as including fabrications.

Mr. Trump also called Mrs. Clinton, “Lyin’ Hillary,” recycling a nickname he deployed to great effect against Senator Ted Cruz of Texas in the primaries. He added that Mrs. Clinton belonged in prison because of her use of a private email server when secretary of state.