Basically the "crime" for which Heliogbalus was killed was losing a power struggle.
As for actual legal crimes he/she committed, try treason (revolting against Emperor Macrinus and overthrowing him) and murder (since hundreds and possibly thousands of soldiers and officials were killed during that illegal process). One of the persons murdered was Macrinus's nine year old son Marcus Ophelius Diadumenianus.
That is why I really hate the leaders of the party of Elagabalus, for starting a conflict where no matter who won, a child was likely to be murdered by the victors.
Thus we see that Elagabalus was just as evil, brutal, and criminal as previous usurping emperors such as Augustus the revered founder of the empire, Vitelius, Vespasian,and Septimius Severus and deserved to be swiftly overthrown and killed just as much as they did.
It may be noted that thousands of Roman soldiers fought to put Elagablus on the throne, and they justified their treason and murder by being convinced that Macrinus had murdered the evil-but-popular-with-the-soldiers emperor Caracalla, and that Elagabalus was the illegitimate son of Caracalla and thus the rightful emperor - from a certain point of view.
And no doubt Elagabalus was also persuaded to believe that wrong was right. It would have been very hard for a child of 14 (or 12 in one account) to be better in seeing the flaws in the arguments presented by his/her family than grown men were.
The other terrible evil crime he/she allegedly committed was human sacrifice of children. If that was true Elagabalus was certainly evil. Of course, even if that accusation was true, and it probably wasn't, Elagabalus could have claimed that he/she was not killing the kids for his/her own benefit but to get the favor of the gods for everyone in the whole Roman Empire or even in the whole world.
Other crimes that Elagabalus certainly committed but was never accused of by historians were:
Permitting gladiatorial games to continue instead of forbidding them and tyrannically depriving the plebs of their entertainment.
Permitting slavery to continue instead of setting the slaves free and tyrannically depriving the slave owners of their wrongful property.
And last, permitting parents to continue throwing away any newborn children that they didn't want to raise, instead of tyrannically depriving the parents of their tyrannical power over their children.
But of course ancient historians never criticized Elagabalus for permitting those crimes to continue.
As for the crimes, sins, misdeeds, unpopular lifestyle choices, etc. that they do accuse Elagabalus of, some modern historians are skeptical of some or even all of those accusations.
So every one of those accusations fall somewhere on a spectrum between being absolutely true and absolutely false.
And every one of those accusations also falls somewhere on a spectrum between being an evil deed and being a good deed.
And every one of those accusations also falls somewhere on a spectrum between being something disgusting and being something charming that we can approve of.
We can each decide pretty accurately how we feel about each of the accusations against Elagabalus and if we would like him/her more or less if it was true, and we each can make a fairly accurate decision about how good or evil each accusation against Elagabalus would be if someone did it in reality. But none of us has the power to know if any or all accusations against Elagabalus are true.
So I would say that Elagabalus was unpopular during his/her/their reign with some segments of the population due to an innovative religious policy and to some personal habits considered effeminate by some, and that after Elagabalus was brutally murdered the party of the killers accused Elagablus of everything but the kitchen sink to blacken his/her/their name and were followed by historians eager for good stories.
In conclusion, one reason why the infamy of Elagablus continued for ages to come was that Elagabalus was allegedly similar in some ways to emperors considered bad, and totally different from emperors considered good or great.
For example, Elagabalus "waded through a sea of blood to seize the throne", as the saying goes, which is totally unlike all emperors with good reputations such as Augustus, Vespasian, Diocletian, or Saint Constantine the Great.
Elgabalus had an innovative religious policy, which is totally unlike emperors with good reputations such as Aurelian and Saint Constantine the Great.
Elgabalus allegedly dressed like a woman or an oriental high priest or king, wearing dresses or robes of Chinese silk dyed with Tyrian Purple, or of cloth of gold, or studded with jewels, and crowns of gold and gems, unlike emperors with good reputations like Aurelian and Diocletian.
So basically "all the crimes of Heliogabalus" came down to being totally different from all the good emperors, before and after his time.