The 21-year-old made his Gunners breakthrough in 2012 but after struggling to command a regular berth and having a loan spell with West Brom, joined Werder Bremen last summer.
An impressive season including 11 goals from 27 games brought him to the attention of the Bundesliga champions.
"It is a great honour to be part of FC Bayern," he said.
"Before me lies an exciting time, which I am very much looking forward to."
Bayern chairman Karl-Heinz Rummenigge added on his club's website: "We are delighted to see another young German national player in FC Bayern in Serge Gnabry. Serge has developed very well in Bremen."
Find all the latest football transfers on our dedicated page.
Bayern Munich have signed former Arsenal winger Serge Gnabry on a three-year deal.