In the early years of comics, Superman was very popular. The thing to do was to either make a hero to rival Superman or make a Superman clone. Captain Marvel by Fawcett comics published under DC was made from an original design, the boy Billy Batson who when he said the magic words, SHAZAM, transform into a stronger version of his kid counterpart. SHAZAM is an acronym for the Greek gods that give Billy and the wizard before him their power. Billy names himself after the family that adopted him, the Marvel family. He was somewhat popular along with the fact that there was already a superhero in DC, the people who made Superman. DC was sued Fawcett comic because they thought Fawcett comics was ripping off Superman. DC ending up buying Fawcett comics and Captain Marvel.
The popularity of superhero comics was coming to an end along with Whiz comics, so DC had put the character away after canceling the series connected to Captain Marvel. In the 1960s, Marvel came out with a comic named Captain Marvel. Captain Marvel is named after an alien named Mar-Vell who is shot with a weapon that gives his race powers. This established the name of Captain Marvel as a Marvel comic property along with the trademark of the names because DC only had a trademark to the character. When DC wanted to bring the character back about a decade after Mar-Vell, DC had to put the comic under the name SHAZAM. Mar Val died in the comics and his sidekick Ms. Marvel took up the mantel of Captain Marvel. This is why Captain Marvel is female in the comics which the movie is based on.
Now, the original Captain Marvel is owned by DC, which is why SHAZAM is not a Marvel movie. Both characters are technique Captain Marvel but DC can risk being sued by Disney like how they sued Fawcett comics back in the day.
Picture Posted on the forum Restera by the user TheGamingNewsGuy