But the 59-year-old Dutchman has agreed to leave a year before his contract is due to expire following a season without a trophy.
Bayern currently sit in fourth position in the Bundesliga and are out of both the German Cup and the Champions League, crashing out of the latter at the last 16 stage
after losing on away goals to Inter.
Leverkusen are out of the Europa League but sit second in the Bundesliga, seven points behind leaders Borussia Dortmund with seven games left to play.
And Heynckes has pledged to ensure that the club he joined two seasons ago will finish the season strongly.
"Leverkusen is a well managed club with a great team and it was difficult taking this decision," Heynckes said in an earlier statement.
"I will do everything so we finish second in the league and qualify directly for the Champions League."
Dutt, who steered Freiburg to promotion to the Bundesliga two years ago, has signed a two-year contract at Leverkusen and will join the club on 1 July.
"Robin Dutt was always going to be our first choice to succeed Heynckes whether in 2011 or 2012," said Leverkusen sports director Rudi Voeller.
The 46-year-old will be replaced at Freiburg by reserve coach Marcus Sorg.
Dutt said: "I am looking forward to the challenge that is Leverkusen. Bayer's philosophy is in line with my views on football."
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.