Elon rallies against regulation? He was the one calling for regulation of Ai. He spoke about this in the interview he gave, he's only been against out against a tiny number of the literal millions of rules his companies adhere to.
He's spoken in favour of regulation where it suits him (and in this instance, completely coincidentally in a way that would slow down established competitors whilst he orders his programmers to start working on one).
Meanwhile he's actively encouraging people to ignore basic safety rules (and IIRC complaining about paying the fines from "minor" breaches) because he doesn't like the deliberately "highly visible" bright colours as they're "ugly" that go with things like "hi vis vests" and "danger zone" markings on the floor, you know those useless regulations that were put in there just because some petty bureaucrat thought "it'd be nice to have some bright colours around the work place" and not because those colours and marking were chosen very specifically so that they made hazards obvious to the human eye by standing out.
Then there are the safety breaches at Tesla factories and SpaceX that are very definitely actively harmful to workers and against the national rules but he's willing to pay the fines and use company security to help shut down whistleblower and people that speak out about it (IIRC he's got welders at Space X doing "precision"* welding in tents without the required masks to protect their lungs).
Or the way he sacked vast swathes of Twitter staff without any regards for the laws under which they were employed, let alone their own contracts (some of those decisions were very public and resulted in a extremely public humiliation for him as he realised that there were iron clad contracts that were about to cost him tens of millions), and the "regulations" he's really not liking at the moment are the ones that require Twitter to do things about it's content where it is illegal in not just individual countries but in some cases pretty much everywhere (shame he fired most/all of the people involved in dealing with that content, and pulled twitter out of various industry groups where they shared information on trends in it, and strategies for dealing with it effectively).
It's like a lot of stuff with musk, he's for it when it works in his favour, he's against it if he doesn't like it personally, it inconveniences him, or it helps someone else but not him.
*I'm no genius, or welder, but i'd argue it's very hard to get a good weld (or even just of repeatable quality), let alone one up to say Nasa standards in an open sided tent in a dusty environment, but what do I know, I've just talked to welders, read some articles, and watched enough documentaries to understand that the key to good QC is getting the conditions repeatable and eliminating as many contaminants as possible so you don't build a dozen of something only to have 10 of them fail inspection, or for them all to have random flaws due to contamination from external materials.