Kompany, 38, joins Bayern despite seeing his Burnley team relegated from the Premier League this season. "I'm looking forward to the challenge of FC Bayern. It's a great honour to be able to work for this club - FC Bayern is an institution in international football," said Kompany in a club statement.
"I'm now looking forward to the basics: working with the players, building a team. Once the basis is right, success will follow."
Kompany's hiring brings to an end Bayern's exhaustive search for a replacement for Thomas Tuchel after the club's first trophyless season in 12 years.
Leverkusen coach Xabi Alonso, Germany boss Julian Nagelsmann and Austria manager Ralf Rangnick all reportedly turned down Bayern's interest. After taking over at Burnley in July 2022, Kompany led the Clarets to promotion from the second-tier Championship in his first season in charge.