The hosts dominated proceedings for the majority of the first half but it was the Premier League side who opened the scoring when Alvaro Negredo latched onto Samir Nasri's pass to fire low past Manuel Neuer.
However, City were in front for only a matter of minutes as Thomas Muller equalised from the spot after Pablo Zabaleta was adjudged to have handled inside the area.
Bayern then took the lead through a Mario Mandzukic header after an inch-perfect delivery from Muller down the right.
After a quiet opening, Bayern should have taken the lead in the 29th minute, with Javi Martinez taking Arjen Robben's far-post cross away from his better-placed defensive colleague, Dante.
City immediately went close against the run of play when Stevan Jovetic shimmied inside onto his right foot and lashed just wide as the first half ended goalless.
But Negredo opened his City account on the hour when he beat Martinez and fired inside the far post on 61 minutes.
The lead lasted only five minutes, though, as Muller tucked away a penalty after Zabaleta was harshly penalised for handball.
And Mandzukic then stooped to head in Muller's cross and make it 2-1, just beating fellow City defender Jerome Boateng to the chance.
In the earlier third-place play-off, AC Milan beat Sao Paulo 1-0 thanks to Kingsley Boateng's goal early in the second half.