The M rating isn't a badge of quality — it's a content label, and it exists because more games are being made with adult players in mind.
As the average age of gamers has climbed, studios have leaned into darker themes: graphic violence, strong language, sexual content and heavier moral choices. Any one of those can push a title into the mature bracket.
The rating is guidance for parents and buyers rather than a barrier, so it's worth reading the specific content descriptors on the box instead of assuming the number tells the whole story.