The 21-year-old, who joined Werder Bremen from Arsenal last summer and had a breakthrough season that saw him score 11 goals.
Bayern chairman, Karl-Heinz Rummenigge, said the club went for Gnabry in recognition of the immense development he has had since his return to the Bundesliga.
He said “we are delighted to see another young German national player in FC Bayern in Serge Gnabry.
“Serge has developed very well in Bremen. ”