"We are very pleased that we have managed to convince the football expert Pep Guardiola, who was coveted and contacted by many top clubs, to come to Bayern Munich," Bayern chief executive Karl-Heinz Rummenigge said.
"He is one of the most successful coaches in the world and we are sure that he can make not just Bayern, but all of German football shine."
Bayern are currently nine points clear at the top of the Bundesliga, and face Arsenal next month in the last 16 of the Champions League.
Heynckes, 67, informed the Bundesliga club before Christmas that he did not want to extend his contract beyond this summer.
His contract expires on 30 June, with Guardiola taking charge the following day.
Bayern's general manager Uli Hoeness said: "Only a coach of Guardiola's calibre came into consideration as a successor to Jupp Heynckes."
Some of Europe's biggest clubs had been linked with the Spaniard since he left Barcelona, including English trio Manchester United, Manchester City and Chelsea, Italian giants AC Milan and big-spending Paris St Germain.
Archive: Pep Guardiola's emotional Barcelona exit
The appointment of former Barcelona duo Txiki Begiristain and Ferra Sorriano at the Etihad Stadium had fuelled speculation City could be a possible destination for Guardiola.
Speaking in November, Milan president Silvio Berlusconi said: "Who would not want someone like Guardiola? There are some English clubs after Guardiola, especially [Manchester] City who have directors that we know very well. We will try to sign him, but it's going to be difficult."
Rummenigge, meanwhile, backed Heynckes, now in his third spell at Bayern after returning to the club in June 2011, to continue to excel in his final months as coach, having guided Bayern to a nine-point lead in the standings as the Bundesliga resumes following the winter break this weekend.
"As a club and as Jupp Heynckes' friends we have to show understanding for this decision. We have to accept it and we have to respect it," Rummenigge added.
"During personal talks with Jupp Heynckes we assured each other that we will do anything we can - and even more so now - to have a successful second half of the season and bring the title to Munich."
He said: "As a player I couldn't realise my dream to play [in England]."
"But I hope in the future, I have a challenge to be a coach or a manager there."
Guardiola retired from playing in November 2006 and was named Barcelona B coach in 2007, but spent only a year in charge before being promoted to replace Frank Rijkaard as boss of the senior side.
Under Guardiola, Barcelona established themselves as the dominant force in club football, with two Champions League crowns and three La Liga titles among the trophies claimed by a side containing names such as Lionel Messi, Xavi and Andres Iniesta.
"Bayern Munich is one of the best clubs in the world, if not the best," ex-Bayern midfielder Dietmar Hamann told BBC Radio 5 live.
"If he'd chosen Chelsea he'd have been given more time but Bayern have been to two Champions League finals in the last few years and he must feel he has a serious chance to win the Champions League with them - they're right up with the top clubs in Europe."
Former Bayern, United and City midfielder Owen Hargreaves told BBC Radio 5 live: "I think it's a smart move. People look at the glamour of the Premier League and its global appeal but he probably saw the structure in place at the club, its success and quality of players.
"The facilities and stadiums are perhaps better than anywhere in the world, he probably saw this and, in my opinion rightfully so, thought that was the best destination for him.
"Barcelona, Real Madrid and Manchester United are some of the biggest clubs in the world but Bayern are easily in that top five, regardless of what order you go 1-5."
This page is best viewed in an up-to-date web browser with style sheets (CSS) enabled. While you will be able to view the content of this page in your current browser, you will not be able to get the full visual experience. Please consider upgrading your browser software or enabling style sheets (CSS) if you are able to do so.