The 31-year-old arrives after eight seasons at Bayern, where he made 312 appearances, scored 51 goals and won seven Bundesliga titles and three German Cup trophies plus the Champions League following his move from Schalke in 2018.
The experienced Goretzka featured three times for Germany at the World Cup and has 73 caps for his country.
He is expected to bolster Unai Emery's midfield after a close season of departures, with Youri Tielemans moving to Manchester United and Morgan Rogers to Chelsea.
Villa defender Ezri Konsa has also joined Arsenal.
