The 24-year-old Morocco international has agreed a four-year contract at the Allianz Arena.
Mazraoui came through the Ajax youth ranks and made 135 competitive appearances for the club, winning three Eredivisie titles.
Mazraoui was linked with Barcelona as well but has chosen Bayern Munich as his next career path.
"I had a good feeling right from the first talks with Bayern and I'm happy to be moving to one of the biggest clubs in Europe," said the 24-year-old.
"Bayern have just become German champions for the tenth time in a row and will also be among the contenders to win the Champions League again next year.
"I chose this club because I can win the biggest titles here."
Bayern Munich sporting director Hasan Salihamidzic added: "We are delighted that Noussair is our first signing of this transfer window.
"He had offers from all over Europe and chose us because we have a clear plan with him and we want to achieve big goals with him.
"Noussair is a player who puts a lot of pressure down the right offensively. We also like his mentality very much. He burns for this challenge at Bayern."
Mazraoui, who has 12 caps for Morocco, is set to play at the Qatar 2022 FIFA World Cup later this year.