The Germany international was one of the hottest properties on the market due to his contract situation, having turned down the offer of fresh terms at the Veltins-Arena.
Liverpool were rumoured to be leading the race for Goretzka at one point, but Schalke's domestic rivals Bayern have persuaded the midfielder - officially a free agent from July - to choose the Allianz Arena over Anfield.
Speaking at a press conference on Friday morning, Schalke chief executive Christian Heidel told reporters: "Leon Goretzka informed us earlier this week that he wants to leave the club to join Bayern Munich.
"We noted that with regret. [Bayern chief] Karl-Heinz Rummenigge has told us that Leon has passed his medical. We are losing a very good player. He has an agreement with them from July 1. We've done everything we can to keep Leon at Schalke."
Goretzka, also touted with moves to Barcelona and Manchester United at various points over the last six months, has four goals in 11 Bundesliga outings for Schalke this term but has been injured for over a month.