The 17-year-old left-back -- whose deal at the Bernabeu expired on June 30 after a failure to reach an agreement on a renewal -- moves to Old Trafford as a free agent.
Fernandez joined Real Madrid from Deportivo La Coruna in his native Galicia in 2017, beating competition from a number of top clubs for his signature.
"It hasn't been an easy decision and I only have words of thanks," he said on Instagram. "I've taken the decision to leave this great club... The time has come to say goodbye and take another path in my footballing career."
The defender played for Madrid's Under-15s, U16s and U17s in his three seasons at Valdebebas, being known as an attacking full-back with impressive physique and pace.
He was part of a talented generation that features some of the most highly-rated players in Real Madrid's academy such as midfielder Bruno Iglesias and forward Israel Salazar.
Sources have told ESPN that Fernandez views United as a better option for his development in the short and medium-term.
He is expected to feature for United's reserves next season, with the possibility of training with the first team when defensive reinforcements are required -- a faster career progression than would have been available in Madrid.
The signing of Fernandez is not the first time that Manchester United have targeted the academies of La Liga clubs this summer.
ESPN's Alex Kirkland contributed to this report.