He has had sex-selective IVF for all of his children, and all that we know about have been biologically male.
Vivian has pointed this out - Elon feels personally affronted by having a daughter. She was selected to be be male at birth in a VERY LITERAL sense. Her being transgender is an explicit rejection of his wishes, and that triggers him.
Especially since he seems to ignore those children except the one he drags around with him.
Maybe he has some dream about being a patriarch of a giant family.
Actually, considering his "pay someone else to play video games" actions, it makes sense that he's paying others to raise his kids. He seems to want the appearance but none of the work behind it.
He legitimately believes that we're in a simulation. While scientists have explored the thought experiment to improve understanding of the universe, he took all the wrong lessons from it and considers everyone else an NPC. So to me it makes complete sense that an idiot like him would use his money and power to make as many boys as possible in that way.
I have a lot of skepticism about the "stalker threatened the vehicle" story that came out of Musk, especially considering his security never called 911 or anything corroborating, but on this note, in two separate incidents where two of his children were in a vehicle, his public statements afterwards commented on the threat to or safety of the male child, and made no mention of the female child in the same car.
Vivian has pointed this out - Elon feels personally affronted by having a daughter. She was selected to be be male at birth in a VERY LITERAL sense. Her being transgender is an explicit rejection of his wishes, and that triggers him.