Gnabry marked his first start for almost a month with a superb display, helping himself to a treble and laying on the other two goals for Robert Lewandowski in the city where he was born.
The Germany forward gave Bayern a 1-0 half-time lead and it ran riot after the break, scoring three times in the space of five minutes behind closed doors at Mercedes-Benz Arena.
Gnabry was directly involved in five goals in a competitive match for only the second time in his career, with the only previous instance coming in the 7-2 win at Tottenham in October 2019 - when he scored four and provided one assist
Victory in Julian Nagelsmann's 200th Bundesliga match as a manager put Bayern nine points clear at the top of the table.
Nagelsmann lauded Gnabry, who has had to bide his time to force his way back into the team after a spell in quarantine and has also been hampered by an injury.
"He is an outstanding player who is currently struggling with his back and therefore maybe gets a tad less minutes than he deserves," Nagelsmann said. "He did very, very well today."
It was another devastating performance from the Bavarian giant, but there was concern when Bayern lost Kingsley Coman to an injury in the first half
"We don't have an exact diagnosis for him yet," Nagelsmann said. "It's a muscular issue. We're hoping that it's nothing serious."
Lewandowski's double took him level with the great Gerd Muller on a record 41 goals in a calendar year in the German top flight.