Elon Musk's AI startup xAI is taking over the social media platform X, also owned by Musk, through a share swap agreement.