Guardiola had been linked with a number of European football's most prestigious managerial posts, but has ended the prolonged and intense speculation over his future by deciding to replace current Bayern coach Jupp Heynckes in the summer.
The 41-year-old has agreed a contract until 2016 at Germany's most famous club, winners of the German title 22 times and the European Cup on four occasions. Heynckes will retire at the end of the season..
Karl-Heinz Rummenigge, Bayern chief executive, said: "We are delighted that we have managed to get Pep Guardiola, whom several big clubs wanted and contacted. He is one of the most successful trainers in the world and we are sure that not only Bayern Munich but the whole of German football will benefit from what he brings.
"As a club and as Jupp Heynckes's friends, we have to show understanding for this decision. We have to accept it and we have to respect it.
"During personal talks with Jupp Heynckes we assured each other that we will do anything we can, and now even more, to have a successful second half of the season 2012/13 where we want to get the title to Munich.“
Guardiola stepped down as Barca coach last summer after steering the Catalan club to 14 trophies in only four seasons, and has spent the intervening time in New York on sabbatical.
Manchester City and Chelsea were among the clubs strongly linked with Guardiola, and on Wednesday, in a video message for the FA's 150th anniversary celebrations, he said of England: "I hope in the future I could be able to train there."
City were believed to be strong contenders to secure his signature, if they felt the need to part company with Roberto Mancini, having already appointed his former Barcelona colleagues Ferran Soriano and Txiki Begiristain at the Etihad Stadium.
But Bayern have managed to secure a huge coup by convincing Guardiola to move to the Bundesliga in the summer, giving the Catalan the chance to replicate the huge success he enjoyed at Camp Nou.
Promoted from Barcelona's B team in the summer of 2008, Guardiola won the treble in his first season as Barca coach and won an unprecedented six competitions in 2009 alone.
A second Champions League title was secured in 2011 when Manchester United were beaten at Wembley, with Barcelona's stunning, artful performance confirming Guardiola's side's status as one of the greatest club sides of all time.
Bayern chairman Uli Hoeness said: "We are extremely grateful for Jupp Heynckes's work, and we would be very happy if the team would give this great coach a glorious farewell.
"As an adequate replacement for Jupp Heynckes only Pep Guardiola was of the right calibre."