My pet theory is he got roped into it because the SEC was going to hit him for securities fraud (wouldn't have been the first time he'd done it[1]). Earlier this year, he had originally said he was buying a 5% share and would be a passive investor. Later on, whoops it turned out he'd bought over 9%[2] of the company without the mandatory disclosures, potentially defrauding the market of over 100 million that he would've paid in inflated share price if his moves had been known to other investors. With the SEC on his trail he said screw it, and inked a very difficult to escape contract to purchase the company. The SEC gets off his back, and he spends months trying to wriggle out of it but finally is compelled by a dead-end court case to fulfill his obligation.
[1] https://www.sec.gov/news/press-release/2018-219
[2] https://www.washingtonpost.com/technology/2022/05/27/elon-se...