Because depending on how you look at it, Twitter suspending Trump (and Babylon Bee et cetera) was part of the motivation for Musk to buy Twitter in the first place.
I don’t think Elon has or ever has had any affinity for Trump. He left his advisor (or something of that nature) spot in the administration quite early on for a reason.
I don't think he cares specifically about Trump, but I do think he cares about Trump being banned from the platform.
How do you know that was his motivation?
Because Elon's been pushing the topic of Twitter and freedom of speech (or the lack thereof) for... a quite a while now.