Carol Danvers’ existence was first teased when Nick Fury activated a special pager before turning to dust at the end of Avengers: Infinity War, and when Captain Marvel came around, the MCU wound the clock back to 1995 to show Carol’s struggles with the Skrulls and Kree, and how she met Fury.
Captain Marvel was officially announced as part of the MCU’s Phase 3 lineup in late 2014 and was originally scheduled to come out in July 2018, but was ultimately pushed to March 2019.