Despite having already secured top spot in Group A, Pep Guardiola selected a strong side for their game in Germany.
Kevin De Bruyne, Jack Grealish, Phil Foden and Riyad Mahrez all started as City looked to finish the group stage on a high.
But they endured a disastrous night at the Red Bull Arena.
Goals from Dominik Szoboszlai and Andre Silva gave the home side a 2-0 lead going into the final 15 minutes.
Riyad Mahrez pulled one back but any chance of a comeback was extinguished when Walker was shown a straight red card with eight minutes remaining.
The Englishman lost his head and just booted Silva from behind.
He was shown his marching orders and he could really have no complaints.
That's a real moment of madness from Walker.
The game was of no importance to City whatsoever. But, after being sent off, he will now miss the first match of their Champions League last-16 tie.
VAR saved Arsenal from taking a BEATING at Everton! Full reaction on The Football Terrace...
City will be joined in the last-16 by Paris Saint-Germain, who beat Club Brugge 4-1 on Tuesday courtesy of a brace apiece from Lionel Messi and Kylian Mbappe.
Among the teams that City could draw in the next round include Barcelona, Juventus and Inter Milan.
It remains to be seen whether Walker's red card proves costly or not.
One thing is for sure: Guardiola would certainly have liked to have him available for their next Champions League match.