City underperformed in the league phase by winning just three of their eight matches to finish 22nd in the table.
Madrid fared a bit better with a final standing of 11th but it wasn't enough to send them straight through to the knockout stage.
They are now competing in a two-legged play-off tie to decide who advances, with the first leg at the Etihad Stadium making history.
City vs Madrid is just the fourth ever European Cup/UEFA Champions League fixture to be played in four consecutive seasons.
MORE ON THE CHAMPIONS LEAGUE
Why Bayern Munich and Harry Kane are banned from wearing home kit in the Champions League
Man City facing February from hell after Champions League draw
Deportivo de La Coruna and Juventus were the trendsetters in the 2000/01 and 2003/04 seasons with four clashes between them.
Chelsea vs Liverpool entertained fans on five occasions from the 2004/05 campaign to 2008/09.
Arch-rivals Atletico Madrid and Madrid then met on four occasions, starting in the 2013/14 final until the 2016/17 season.
The 2021/22 and 2022/23 campaigns saw City and Madrid meet in the semi-finals of the Champions League.
Most read in Champions League
'Are you mad?' - Noel Gallagher in hysterics at Darren Bent's huge Arsenal claim
Stones set for midfield role for Man City while Bellingham starts for Real in blockbuster
'Unacceptable' - Man City urged to do unthinkable if Pep Guardiola can't beat Real Madrid
Why Bayern Munich and Harry Kane are banned from wearing home kit in the Champions League
Last season it was a quarter-final clash between the two, but their latest fixture has come in a new stage of Europe's elite competition.
One of Atletico Madrid and Bayer Leverkusen will meet City or Madrid in the last 16 following the outcome of the second leg on February 19.