Meanwhile, Chelsea had to settle for a 0-0 draw away to Dynamo Kiev but reigning European champions Barcelona won in Belarus and Bayer Leverkusen played out a thrilling 4-4 draw with Roma in Germany.
Bayern arrived in London having won every game this season and they dominated possession for much of an absorbing Group F encounter.
However, they only remained on level terms at the break thanks to a stunning save by Manuel Neuer to keep out a header from point-blank range by the unmarked Theo Walcott.
But Arsenal, in desperate need of a win after defeats to Dinamo Zagreb and Olympiakos in their first two games, took advantage of a howler by Neuer to get the crucial breakthrough with 13 minutes remaining.
The Germany goalkeeper came and missed a free-kick, allowing substitute Giroud to bundle the ball into the net.
Arsenal then secured the points that keep alive their chances of progressing to the last 16 when Ozil’s finish from Hector Bellerin’s assist crossed the line despite Neuer’s best efforts to keep it out.
The Gunners remain bottom of the group with a trip to Bayern to come next, but the four sides are separated by just three points after Olympiakos won 1-0 in Croatia in the night’s other game thanks to a late Brown Ideye goal.
“We had an absolute necessity to win the game and we did it in a disciplined way,” said Arsenal manager Arsene Wenger.
“Bayern had more possession than us, but we decided to make it tight in our final third and catch them on the break.”
Mourinho targets officials
Chelsea remain in a precarious position in Group G after a 0-0 draw with Dynamo Kiev in chilly Ukraine as the recalled Eden Hazard and Willian both hit the woodwork for the visitors.
Chelsea manager Jose Mourinho also felt that his side should have been given a penalty after Cesc Fabregas went down in the Dynamo box during the first half and later told UK television that the referee had been “weak and naive”.
The Premier League champions are third in the group, a point behind Dynamo and three points adrift of Porto, who beat Maccabi Tel Aviv 2-0 in Portugal thanks to goals by Vincent Aboubakar and Yacine Brahimi.
But with home games against Dynamo and Porto to come, as well as a trip to Israel, Mourinho remains confident his side will go through.
“We have the destiny in our hands,” he said. “We play two matches at home and one in Israel, so the qualification depends clearly on us.”
Barcelona strengthened their position atop Group E with a 2-0 victory away to BATE, secured by two fine second-half goals from substitute Ivan Rakitic, both set up Neymar.
“It was a very good game overall from the team. We pressed well and I don’t think BATE had a single chance,” said Rakitic.
The other match in the group was without doubt the game of the evening, with Leverkusen taking a two-goal lead and then falling 4-2 down before fighting back to snatch a precious point against Roma.
Javier Hernandez opened the scoring from the penalty spot for the Bundesliga side and increased their lead in the 19th minute, but Daniele De Rossi replied with a double for Roma before the break.
A tremendous Miralem Pjanic free-kick put the visitors in front and Iago Falque appeared to have secured a first win of the campaign for the Italians in the 73rd minute.
But Kevin Kampl reduced the deficit and substitute Admir Mehmedi rounded off a breathtaking game by making it 4-4 four minutes from time to keep Leverkusen in second place and leave Roma bottom of the group.
Zenit St Petersburg closed in on a quarter-final place with a third straight win in Group H as Artem Dzyuba, Hulk and Danny netted in a 3-1 victory over Lyon, for whom Alexandre Lacazette had equalised.
Valencia are three points back in second place after beating Gent 2-1 in Spain thanks to a Sofiane Feghouli shot that went in off Lasse Nielsen and a Stefan Mitrovic own goal either side of a Thomas Foket strike for the Belgians.