The prolific Poland forward scored the winner from the spot after Mats Hummels was ruled to have handled in the box.
Julian Brandt had opened the scoring in the fifth minute only for Lewandowski to hit back almost immediately.
Kingsley Coman’s deflected effort then found the roof of the net but Erling Braut Haaland levelled after the break.
Lewandowski’s winning goal was his 66th in 55 games in 2021 and his 118th away from home in the Bundesliga, the most in the competition’s history.
Dortmund boss Marco Rose was booked earlier in the game when he felt his side should have had a penalty and was sent off for a second caution for his protests after Bayern were awarded the spot-kick.
The hosts had stormed into an early lead at an electric Signal Iduna Park when Brandt took Jude Bellingham’s pass down superbly, turned inside Alphonso Davies and finished smartly.
But that lead only lasted four minutes as Lewandowski finished off a Bayern break and Coman fired in before half-time.
Haaland curled into the corner to level from Bellingham’s lay off three minutes after the interval – the Englishman’s fifth assist in the Bundesliga this season.
But it was Lewandowski who stole the show with the winner in the 77th minute, despite Gregor Kobel getting a hand to the 33-year-old’s spot kick.
Bayern could have had another when Corentin Tolisso broke deep into added time from a Dortmund corner that Kobel had gone up for, but fired wide of an open goal from distance.
There was also concern for Dortmund when Brandt was carried off on a stretcher after suffering a head injury during a collision with Dayot Upamecano. The Dortmund midfielder, though, was conscious as he left the field.