Linda Yaccarino, the chief executive of X and a top lieutenant to its owner, Elon Musk, said on Wednesday that she was leaving the company two years after joining the social media platform. In a post on X, Ms. Yaccarino, 61, said: “When @elonmusk and I first spoke of his vision for X, I knew it would be the opportunity of a lifetime to carry out the extraordinary mission of this company. I’m immensely grateful to him for entrusting me.” She did not provide a reason for her departure. Ms. Yaccarino’s exit caps a tumultuous period at X, which was previously called Twitter and has been remade in Mr. Musk’s image since he bought the platform for $44 billion in 2022. Since then, Mr. Musk has shed three-quarters of the company’s employees, loosened speech restrictions on the platform and wielded X as a political megaphone. Advertisers were at one point spooked by the changes, and the social media company’s ad business declined. In March, Mr. Musk said he had sold X, which is a privately held company, to xAI, his artificial intelligence start-up, in an unusual arrangement that showed the financial maneuvering inside his business empire. The all-stock deal valued xAI at $80 billion and X at $33 billion, Mr. Musk said. Since then, xAI has been in talks to raise new financing that could value it at as much as $120 billion.