Mazraoui, 24, will join the Bundesliga champions on a free transfer from Ajax once his contract expires in June.
The right-back, who has signed a deal until 2026, could end up being the first part of a double signing from Ajax with Bayern Munich also interested in their midfielder Ryan Gravenberch, sources told ESPN.
Mazraoui came through the youth academy at Ajax and won two Eredivisie titles and two KNVB Cups at the club. He was also a key part of the team that reached the semifinals of the Champions League in 2019.
His departure from Ajax is part of a summer overhaul at the club with manager Erik ten Hag joining Manchester United and the club braced for a series of big-name departures.
Meanwhile, Bayern captain Manuel Neuer signed a one-year contract extension which will keep him at the club until 2024 on Monday.
The 36-year-old goalkeeper has won 10 straight league titles and two Champions League trophies among a host of domestic and European honours since joining Bayern from Schalke in 2011.
"Manuel is a defining figure in the history of FC Bayern," chief executive Oliver Kahn said in a statement. "[He] has been setting the standard around the world for years. It's a huge achievement to be so consistently world class."
Germany captain Neuer, who has made more than 470 appearances for Bayern in all competitions, is the second long-serving player to extend his stay in Bavaria after forward Thomas Muller also renewed his deal until 2024.
"We'll have a very good team again with which we can compete for every title," Neuer said. "As a goalkeeper, captain and leader, I want to be the support and a key factor in our big goals.
"We want to extend our title record and compete again for the German Cup and Champions League."