Great question — answering as the UphillTech team:
NOTE: This is only speculation and not a definitive answer, as at this point there exists no in-universe explanation on how the name was established. My guess is that everyone in the previous movies knew Carol personally as well as her real name (just like Iron Man was called Tony most of the time from people who knew his name). Also, Carol only returned to earth after Infinity War and was unknown to anyone besides the Avengers for the time to come. In Endgame, she started to play an actual role towards the end of the movie and showed her face to the world by destroying Thanos ship and fighting alongside everyone. That was the moment people got to "know" her, but not her actual name. So all...
Full answer by XtremeBaumer: https://movies.stackexchange.com/a/100413 (CC BY-SA 4.0).
Need it done for your business? UphillTech.