The Croatian striker opened the scoring before completing his treble after goals from Dante and Arjen Robben to pile more misery on their hapless hosts
The Croatia international tapped home Mario Gotze's cross in the first half before Dante doubled their 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.
Hamburg battled well in the early stages, and although Bayern had near monopoly of the ball, they failed to create any meaningful chances.
However, on 21 minutes, the visitors found the breakthrough: Gotze drove his way past 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 their control and, just five minutes later, they doubled their advantage, as Toni Kroos' corner was powered into the corner by Dante.
Guardiola's side were in complete control and could have scored a third through Arjen Robben, but his shot was weak and straight at Rene Adler following good build-up between Jerome Boateng and Gotze.
Hamburg tested Manuel Neuer when Ola 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 their 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 commiting 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.
HSV threw on Jaques Zoua as an extra attacker but barely managed to get the ball in Bayern's final third in the closing stages as the holders reached the last four in style to maintain their silverware assault for this season.