Captain Marvel is actually really complicated. Originally it was a character unrelated who's now owned by DC. He was a 10 year old boy who turned into a superhero when he yelled "Shazam" which is now what he's called. There was a lawsuit over Captain Marvel later for being too similar to Superman and the rights were dropped. Then when Marvel became and saw DC had the rights to Captain Marvel, they created a character named Mar-Vell who was their Captain Marvel. He saved Carol Danvers, who absorbed some powers from him and became Ms Marvel until 2012, when she took the mantle Captain Marvel. The current Ms Marvel you mentioned was a massive fangirl of Carol Danvers so she took the name when she got super powers of her own.


