The talented 19-year-old - who has drawn comparisons with Lionel Messi - had been part of City’s youth system since joining them from Malaga in 2013, and was on the fringe of Pep Guardiola's first-team squad.
But the Spanish attacked found opportunities in short supply and was delighted to become Real's first January signing in four years on Monday.
“Today is the most important day of my life,” Brahim told a press conference after the move was confirmed .
“It is the perfect Three Kings gift. My only three options that I wanted were to play for Real Madrid, to play for Real Madrid or to play for Real Madrid.
“I have dreamt of playing for this club since I was a boy.”
Madrid president Florentino Perez, who handed Brahim a six-and-a-half year deal, said: "Brahim has a lot of talent and a strong character, his dream is to triumph for Real Madrid.
“We are always looking to reinforce our squad.”
Brahim had earlier thanked the City supporters for their backing on his few first-team opportunities.
In a statement his official Instagram account he said: “I close a chapter of my life and I say goodbye to Manchester City, the club where I have grown.
“Thank you to all the managers in the club, from the academy to the first team, for believing in me because they taught me not only to be a better player, but a better person.
"Thank you to all the backroom staff and the medical services. Thank you to everyone involved in the offices working to make this club improve every day. Thank you to my teammates.
"And thank you, of course, to every single Manchester City supporter. I will never forget having my name chanted from the stands the night we beat Fulham in the League Cup.
"I came here being a kid and now I am a professional footballer."
The deal is understood by Goal to be to be worth at least £15 million ($19m) plus £6.5m in add-ons to City.
It also includes a 15 per cent sell-on fee that rises to 40% should Real sell the Spain Under-21 international to Manchester United .