Bayern Munich director Hasan Salihamidzic said: "We're happy that we've been able to sign Dayot Upamecano. We're convinced that Dayot will be a very important member of our team in the coming years."
Upamecano reportedly had a release clause worth €42.5 million ($51m) and will bolster the Bayern backline with the Bundesliga club likely to lose defender David Alaba this summer after he rejected Bayern's offer of a new five-year deal.
"Upamecano is a young player, 22, whose qualities have already developed extraordinarily," Salihamidzic said.
"I was always convinced that we had presented a good concept. We presented him with our vision of his career at Bayern. During the past week in Doha I had further talks with everyone involved. At the end of a long process, the players, family and management were convinced that FC Bayern was the right club."
Upamecano will remain with Leipzig until the end of the season. They are are second in the Bundesliga, four points behind Bayern who have a game in hand.