An inspired performance by City goalkeeper Joe Hart looked to have secured his team a point in the meeting of the English and German champions at Munich's Allianz Arena.
But former City defender Boateng hammered a volley into the net in the dying seconds, although his venomous strike appeared to take a deflection off Bayern's Mario Götze on its way in.
Hart had pulled off a string of fine saves from Thomas Müller, David Alaba, Götze and Boateng but the England international was finally beaten as Bayern earned a deserved win in their opening Group E fixture.
Bayern Munich coach Pep Guardiola said his team had trouble coping with Manchester City midfielders Samir Nasri and Jesus Navas early on.
But he was happy to see his side's aggression and positioning improve as the game wore on.
"We played well," he said. "The first 20 minutes Manchester City were better than we were and in the last 15 minutes of the second half we dominated.
"We created a lot of goal chances. It's not easy against Manchester City. We played with a lot of heart and we really deserved the victory."
With Manchester City manager Manuel Pellegrini serving a touchline ban, assistant coach Ruben Cousillas insisted City could recover against Roma and CSKA Moscow in their bid to qualify for the knockout stages.
"I think we played a really good game and it was also good entertainment for the public because there were two teams that tried to score goals," Cousillas said.
"Conceding such a goal in the last minute, that's what makes it really frustrating.
"It's not good to start with a defeat but there are five games left so that means it depends on us."
Manchester City had come back from two goals down to beat Bayern 3-2 at the same venue in last season's group stages and they started with Edin Dzeko, who has yet to score this season, leading the attack instead of Sergio Aguero.
Franck Ribery missed out through injury for the home team, who gave new signing Mehdi Benatia his first start on the right side of a three-man defence.
Bayern were looking to banish memories of last season's 4-0 semi-final defeat to Real Madrid in their last Champions League match in Munich and they almost made a sensational start to the new campaign.
Götze and Robert Lewandowksi released Müller but after rounding Hart, the German attacker shot into the side netting inside 40 seconds.
Dzeko tested Manuel Neuer after a good spell of possession for the visitors but soon the home team started to make an impression at the other end.
After 19 minutes Juan Bernat crossed for Müller, whose bullet header was brilliantly turned over the bar by Hart.
Dzeko curled a left-foot shot just to the right of Neuer's goal and Boateng then cut out a dangerous Navas cross as Guardiola became increasingly animated on the sideline.
Guardiola pushed David Alaba from defence into midfield and the move almost brought an immediate reward when the Austrian shot wide from distance on the half hour.
A minute later, the 22-year-old came closer still. He connected on the volley from Müller's touch down but the strike was once again beaten away by Hart.
With 19 minutes left Hart fumbled Rafinha's shot but the City keeper recovered superbly to deny Müller on the rebound.
A Champions League game involving Manchester City looked to be set to finish scoreless for the first time when Hart turned a ferocious long-strike from Boateng behind for a corner with three minutes left.
But City were struggling to clear their lines and in the final minute Boateng caught the ball sweetly on the volley to beat Hart from the left edge of the penalty area.
Sergio Aguero almost snatched a late equalizer for City but Bayern got their revenge for last season's defeat in Munich.
In the other Champions League game involving British and German teams on Wednesday night, Schalke and Chelsea drew 1-1.
Cesc Fabegras opened the scoring at Stamford Bridge in the 11th minute with his first goal for his new club.
But Klaas-Jan Huntelaar equalized in the 62nd minute on a counter-attack.
Schalke were put under pressure but held for the draw in their first group game.