Elon Musk and his social media company X Corp. have reached a tentative agreement to settle a lawsuit filed by former Twitter employees who said they were owed $500 million in severance pay.