The Croatian striker opened the scoring before completing his treble after goals from Dante and Arjen Robben to pile more misery on the hapless hosts
The Croatia international tapped home Mario Gotze's cross in the first half before Dante doubled the lead with a header.
And Bayern took total control in the second period, with Arjen Robben firing in a third before Mandzukic completed his hat trick to put the holders into the last four.
On 21 minutes, the visitors found the breakthrough. Gotze drove his way past Ola John and Lam down the Hamburg right and pulled the ball across for Mandzukic, who tapped home from point-blank range.
Bayern continued to exert control and, just five minutes later, it doubled the advantage, as Toni Kroos' corner was powered into the corner by Dante.
Hamburg tested Manuel Neuer when John broke down the right and hit a low shot towards the near post, before Marcell Jansen volleyed well wide following good work from Calhanoglu, but the home side failed to offer any significant threat as Bayern cruised towards the break.
The hosts passed up a decent half-chance when John just failed to pick up a through ball, and moments later, Bayern had a third. Kroos fired a superb ball over the top to Robben, who brought it down and rifled low past Adler from inside the area.
Illicevic tested Neuer at the near post before Mandzukic was denied with a header as Bayern entered cruise control at the Imtech Arena, while Hamburg continued to press without ever committing more than two players forward.
Just before the 75-minute mark, Bayern made it four, as Robben found Gotze who prodded the ball to Mandzukic at the far post for an easy finish.
And just a minute later, Mandzukic had his hat trick, turning and firing low between Adler's legs after Hamburg failed to deal with David Alaba's free kick.