His interest in EV tech is because he wants to help solve climate change.
Maybe. Or maybe he just saw Electric Vehicles as a potential major revenue source.
Keep in mind that Musk has said he will support Deathsantis in the next election, who is a republican (and as such is someone who will likely push for more oil and gas usage, less renewables.) Not exactly a "climate friendly" alternative.
You don't take on a rocket company, tunnel company, or EV company if you're looking for the easiest way to make the most money possible. These companies have been riddled with business problems because the ideas aren't easy or popular when they were started.
SpaceX was a risky venture. But, space travel was an untapped market that didn't seem to have players who were stepping in to fill the niche.