The midfielder scored twice as Pep Guardiola's side showed its mettle on the back of Tuesday's Champions League semifinal exit.
Bayern went into the contest on the back of a chastening 5-0 aggregate Champions League semifinal defeat to Real Madrid, but Hamburg was unable to capitalize on the visitors' deflated mood.
Mirko Slomka's men needed to win to stand any chance of avoiding a bottom-three finish and they produced some encouraging moments early on, but the Bundesliga champion's quality eventually shone through.
Gotze, who has endured a disappointing first season at Bayern, put his side ahead just after the half-hour mark to round off a delightful move and Thomas Muller added their second 10 minutes after halftime.
Former Borussia Dortmund playmaker Gotze got his second with just over 20 minutes left, before Hakan Calhanoglu pulled one back for Hamburg.
However, any hope of an unlikely comeback from the home side were dashed by Claudio Pizarro, who struck 15 minutes from time to restore Bayern's three-goal cushion before Jerome Boateng was sent off late on following an altercation with substitute Kerem Demirbay.
Defeat for Hamburg means the club can now only finish the season as high as 16th, which would see it face a relegation playoff.
In the wake of Bayern's humiliating Champions League exit, coach Pep Guardiola defiantly defended his football philosophy, and the German champion showed no sign of abandoning the possession-based game in Hamburg.
But despite the attempt to monopolize the ball, the home side created the better chances inside the first 20 minutes.
With 11 minutes played, Ivo Ilicevic pounced on Manuel Neuer's skewed clearance before cleverly flicking the ball over Dante and blasting a half-volley into the side netting.
Highly-rated midfielder Calhanoglu cut in from the left with intent shortly after, but once again Bayern escaped unscathed as the Turkey international fired wide of the right-hand post.
And Bayern duly capitalized on those let offs in the 32nd minute, as Gotze combined brilliantly with Arjen Robben inside the penalty area, before coolly slotting under Rene Adler.
Hamburg almost levelled just before the break, but Neuer produced a fine save to deny Rafael van der Vaart's half volley.
Ominously for Hamburg, Bayern began the second half with renewed focus and after Robben won a corner following a devilish run in towards the right-hand post, the club doubled its lead.
Robben delivered the set piece along the floor to Gotze, and the 21-year-old fired through a crowd of players before Muller flicked it past the helpless Adler.
Gotze got his second of the game in the 69th minute as he brought the ball down nonchalantly in the area before confidently converting a half-volley in from close range.
Hamburg's hopes of a late comeback were given some encouragement as Calhanoglu rifled into the bottom-right corner from long range three minutes later.
But Pizarro's audacious over-head kick, which came just two minutes after he replaced Robben, added gloss to the scoreline for Bayern - whose day was marred slightly when Boateng received his marching orders for going head-to-head with Demirbay after the Hamburg man had tried to win a penalty.