Gravenberch had one-year remaining on his contract at the Johan Cruyff Arena, allowing Bayern Munich to get him on a bargain price of £16m.
The 20-year-old came through the youth ranks at Ajax before graduating to the first team and making 103 appearances, scoring 12 goals.
Gravenberch helped Ajax win three Eredivisie titles and two Dutch cups in his time at the club.
The Netherlands international is the second player Bayern Munich have signed from Ajax this summer after Morocco right back Noussair Mazraoui.
"When the offer came from FC Bayern, I didn't have to think about it for long," Gravenberch told the club's website after the move was confirmed.
"FC Bayern are one of the biggest clubs around; players from all over the world want to play for this club. I'm coming to Munich to win lots of titles - and FC Bayern are used to winning lots of titles.
"Anything is possible with this club, including winning the Champions League. The togetherness in this team is very strong, which I like."
Bayern's sporting director Hasan Salihamidzic added: "Ryan Gravenberch will offer a lot to our team. He's one of the biggest talents in Europe, has superb technical ability, always finds solutions in tight spaces, is very dynamic and a goal threat," he said.
"The fact he's chosen FC Bayern shows that he's convinced by us as a club and the opportunities here. We love players with that mentality. We're confident that we'll enjoy lots of success with him."
Gravenberch has won 10 caps for the Netherlands national team.