Bayern have met the release clause in the 22-year-old's contract.
"We're happy that we've been able to sign Dayot Upamecano for FC Bayern Munchen. We're convinced that Dayot will be a very important member of our team in the coming years," Bayern board member Hasan Salihamidzic told the club website.
Upamecano, who has three caps for France, joined Leipzig from RB Salzburg in 2017 and has become one of the most highly-rated defenders in Europe.
RB Leipzig chief executive Oliver Mintzlaff says Upamecano, who will line up for the German side in the Champions League against Liverpool this week, indicated he wanted to move on.
"Of course, we would have liked to keep Dayot Upamecano at RB Leipzig. However, Dayot indicated to us very fairly and in good time that he would like a new challenge this summer and take the next step," Mintzlaff said.
"Dayot has shown outstanding development during his time in Leipzig, which is exemplary for our philosophy of finding young talents and consistently bringing them to the top level.
"Dayot has been and remains an important factor in our success and FC Bayern can look forward to an outstanding footballer and great person."