So, as a kid, I checked out "Shazam from the 40s to the 70s" a lot! It's a really cool collection of the old Captain Marvel comics drawn by CC Beck and others.
Billy Batson transforms into a superhero known as Captain Marvel!
Thing is, Marvel comics didn't like this, and sued DC; they didn't want the comic name to be "captain marvel," and the series died for a while. It's similar to how DC sued Miracleman out of existence over Captain Marvel. DC came back and started calling the comics Shazam (like Ordway's "The Power of Shazam") while the character was still named Captain Marvel!
As I recall, during the hiatus, Marvel created "Captain Marvel," hoping to take over the name. That's the Mar-Vell who died of cancer in a Jim Starlin comic.
Eventually, Marvel's Ms. Marvel, Carol Danvers, took on the name Captain Marvel (and the red/blue/yellow visual iconography, getting rid of her black and gold color scheme) and the name Ms. Marvel was passed down to Kamala Khan.
DC Comics has been a bit iffy on whether or not Captain Marvel (Batson) should be named Shazam or not, but it's kind of silly to name him Shazam when that's the word he says to transform! As I recall, this shows up mostly in Geoff Johns' interpretation of the character, which I'm not personally fond of.
If you couldn't tell, Mary Marvel and Captain Marvel are my favorite superheroes!