The club said Heynckes, previously at the helm from 1987 to 1991 and again in 2009, would take over on July 1 on a two-year contract.
“Jupp Heynckes was the candidate we were wishing for,” Bayern Munich CEO Karl-Heinz Rummenigge said on the club website (www.fcbayern-t.home.de). “We’re very fortunate.
“I’m convinced that we will have a successful working relationship with Jupp Heynckes.”
Heynckes is currently with Bayer Leverkusen, who are second in the Bundesliga but he had already agreed to leave at the end of the season despite their success.
Last season, Leverkusen equalled the record for the longest unbeaten start to the Bundesliga season when they went 24 games without defeat. The previous record had been set by Bayern, also coached by Heynckes, in 1988-89.
Heynckes won two Bundesliga titles in his first stint with Bayern but failed to win a trophy the second time around.
He has also coached Athletic Bilbao, Real Madrid and Benfica among others.
Champions Bayern had already announced Van Gaal would be leaving at the end of the campaign after a disappointing season. They lie fourth in the league.