The original copyright holder of the name Captain Marvel used to be Fawcett Productions, who came up with a superman type character named Captain Marvel. The character’s real name is Billy Batson, a young boy who was given the power of the Gods by the Wizard Shazam, Marvel Comics had copyrighted the name Captain Marvel so DC could use the character, but they couldn't call the book or the character Captain Marvel.
They decided to go with Shazam. This was Billy Batson's magic word to transform into a hero as well as the name of the wizard. They could still reference the Marvel family in the books, but they couldn't officially use the title anymore.