Musk didn't, of course. Neither did any of the cabinet members win an election for that position. Neither did any of the cabinet members or advisors of any previous administration.
But Musk being appointed is a consequence of Trump's election, just like all cabinet members, advisors, and so on for every previous administration. You elect the person, you get their crew.
So people like Musk are "taking over" from other people who did not themselves win an election, but were put in positions of power by those who did win elections.
If you're going to argue that Musk wasn't elected (and he wasn't), then you also have to note that every person that is getting replaced by a Trump appointee is also someone who wasn't elected.
I may not like the people Trump is putting in position - they, um, don't seem like A players - but this particular criticism is unfair. Trump won a democratic election; he appoints his people just like all previous administrations did.