Academy graduate James McAtee - on loan at Sheffield United last season - opened the scoring with a close-range effort in the first half, before Bayern teenager Mathys Tel restored parity with a similar strike in the 81st minute.
However, Pep Guardiola's side had the last laugh as Aymeric Laporte tucked away the winning goal five minutes later to help the treble winners maintain their perfect start to pre-season, condemning Thomas Tuchel's men to their first loss in the process.
There was plenty of talk prior to kickoff about Kyle Walker's future amid interest from Bayern, but Guardiola confirmed his availability at a press conference on Tuesday and the defender was named in the first XI as captain for the second time in pre-season after wearing the armband in the 5-3 win over Yokohama F Marinos last weekend.
Guardiola made a total of four changes to his starting lineup, with Ederson, Ruben Dias, Bernardo Silva and Rico Lewis all coming in, with the latter an intriguing inclusion in a deep-lying midfield role alongside John Stones.
Bayern, meanwhile, were without the likes of Manuel Neuer, Thomas Muller and Raphael Guerreiro due to injury, but they still fielded a strong lineup including former City star Leroy Sane, new recruit Konrad Laimer and Benjamin Pavard, who has been linked with a summer move to the Etihad Stadium.
City made a bright start to proceedings in possession, and strong build-up play down the right flank resulted in the first shot of the contest just five minutes in when the ball eventually fell to Stones who dragged an effort wide.
A sharp-looking Bayern side responded well and showed early signs of their threat when regaining possession, with their fluid midfield and pacey frontline charging towards City's defence.
Bayern came close with efforts from Serge Gnabry and Jamal Musiala before Sane rattled the crossbar on the 19-minute mark with a sweetly-struck free kick from around 25 yards out.
The Bundesliga champions were ultimately unable to take advantage of their early dominance and found themselves a goal down just two minutes after Sane's strike courtesy of a close-range tap-in from McAtee.
Lewis, a real livewire in midfield throughout the first half, drove down the right to receive a pass from Walker before wriggling his way into the penalty area to cut the ball back for Julian Alvarez. The Argentine shot first time to force a save from Yann Sommer, but McAtee was there to tap in the rebound from a yard out.
City were dealt an injury blow just before the half hour mark when Nathan Ake gingerly walked off with an apparent ankle issue, with Manuel Akanji coming on as his replacement.
Bayern came back to life towards the end of the first half, posing a real threat on the counter-attack, with City goalkeeper Ederson called into action a few times to ensure the Citizens entered the break with their narrow lead.
Bayern changed their entire lineup for the second half, while City made eight changes of their own, brining on the likes of Laporte, Rodri, former Bavarian loanee Joao Cancelo and goal machine Erling Haaland, who scored twice against Yokohama.
The Germans started the brighter in the second half, but City came close to adding a second just before the hour mark when Oscar Bobb played through Bernardo Silva down the right side of the box, before the Portuguese's cross tricks Bayern substitute goalie Sven Ulreich as the ball fizzed across the face of goal.
Rodri then pounced and fired an effort goalwards from around 10 yards, but the ball glides past the wrong side of the post as Bayern survived a brilliant opportunity for the Citizens.
Bobb looked lively for City and fired a powerful strike narrowly over the crossbar, but it was a substitute from Bayern who levelled the scores nine minutes from time courtesy of a tap-in from 18-year-old Tel.
Following a brilliant run down the left flank, Frans Kratzig cut the ball back to Leon Goretzka who fired straight at Ederson before Tel nipped into the six-yard box to poke home the rebound.
City responded well, though, with both Haaland and Laporte coming close, before the latter was in the right place at the right time to net the winning goal in the 86th minute, reacting first to place a right-footed shot into the centre of the goal after Bernardo Silva came close from tight angle.
Guardiola's side will now travel to Seoul for their next pre-season match against Atletico Madrid on Sunday, while Bayern will remain in Tokyo as they prepare for an encounter against Kawasaki on Saturday.