Both in the EU and the US there is plenty of regulation that mandates these types of censorship - and with reason.
In the US there is 18 U.S.C. § 842(p).
In the EU there is the entire AI Act.
But I am sure you can yourself chat your way through to figure out what legislation companies like OpenAI and Anthropic are under.