Twitter’s management, acting in the best interest of their shareholders, used the court to force him to hold to the contract when he tried to walk. Musk decided to buy the company for the agreed on price rather than have that imposed on him by court order after (more) embarrassing discovery.
Seeing Musk as a business genius in this deal requires ignoring nearly every event in the saga.