There are lots of messages with lots of claims.
Apple doesn’t send email with these claims, they lock your Apple ID.
So this isn’t legitimate.
Here, the senders were probably providing links to a fake Apple login portal, and if you used those links to that fake login portal and provided your Apple ID credentials, that phish would be how your Apple ID was hacked.
Change your password as mentioned above if you want, and enable two-factor authentication if not already.
You can also run Safety Check: Personal Safety User Guide - Apple Support
Phishing is very common, though.
Here are a very few of the many scams: Recognize and avoid phishing messages, phony support calls, and other scams - Apple Support