After losing both opening matches for the first time, Arsenal desperately needed a win to keep alive its hopes of reaching the knockout round.
Arsene Wenger's men delivered at the Emirates Stadium, ending Bayern's run of 12 straight wins with second-half goals from France striker Olivier Giroud and Germany playmaker Mesut Ozil.
"They dominated the game, but we knew that and we were able to finish it off," Giroud said. "We needed this win to stay in the Champions League and to try and qualify for the next stage. We have to thank Petr Cech too, he had a fantastic game."
Defending champion Barcelona remained in control of top spot in Group E as Ivan Rakitic scored both goals in a 2-0 win at BATE Borisov, while Roma came back from a 2-0 deficit in a 4-4 draw at Bayer Leverkusen in a topsy-turvy game.
In Group G, Chelsea coach Jose Mourinho complained about the referee after the Blues were held to a goalless draw at Dynamo Kiev. Portotops the standings after a 2-0 defeat of Maccabi Tel-Aviv.
"The referee was weak and naive with the penalty," said Mourinho after his side was not given a penalty when Cesc Fabregas went down in the area. "My first thoughts were that it looked like a spot-kick. I cannot understand what the referee behind the goal does, because he doesn't make a clear decision too."