The Poland international will leave BVB for the reigning German champions once his contract expires next summer
The 25-year-old forward had long been linked with a move to the Allianz Arena side and he has now signed a five-year deal with the Bavarians.
Clubs such as Real Madrid, Manchester United and Arsenal had also shown an interest in signing the prolific Poland international, but he will continue his career in the Bundesliga instead.
Lewandowski had been close to joining Bayern last summer, but the move eventually fell through as Dortmund vetoed a move to the Allianz Arena, accepting the fact that they would ultimately lose him for nothing.
Bavarians chief Karl-Heinz Rummenigge described the Pole as among the best forwards on the planet and insists he will make the club even better when he joins in the summer.
"We are very pleased that we managed to complete this transfer," he told reporters. "Lewandowski is one of the world's best strikers. He is going to strengthen our team, he will give us another boost."
The attacker started his professional career at Znicz Pruszkow and also wore the jersey of Lech Poznan before joining Dortmund in the summer of 2010.
He has since developed into a key player at BVB, helping the Signal Iduna side to two Bundesliga titles, a DFB Pokal and the DFL-Supercup.
Lewandowski follows in the footsteps of Mario Gotze - who left Dortmund for Bayern ahead of the 2013-14 campaign - after the European champions agreed to meet the playmaker's €37 million buy-out clause.