Gotze struck twice before half-time, either side of Jakub Blaszczykowski's 18th-minute goal, to ensure a comfortable night for the hosts.
Mame Diouf pulled a goal back on 79 minutes but there was still time for Gotze to complete his treble with five minutes remaining.
Robert Lewandowski scored the fifth goal in injury time as a near full-strength Dortmund side went into the winter break on a high.
With time ticking down Conserva Fagner's 31st-minute own goal appeared enough for Leverkusen, but substitute Christian Trasch (78) scored moments after coming on before Bas Dost won it in injury-time.
Two first-half goals were enough for Stuttgart to overcome second division Cologne 2-1.
Christian Gentner scored first on 31 minutes before a Vedad Ibisevic penalty four minutes later. Christian Clemens grabbed Cologne's goal with 10 minutes left.
Marcel Maltritz scored twice late to secure VfL Bochum a 3-0 win at home to fellow second-tier side 1860 Munich.
Bochum sit just above the drop zone but defied their position as Zlatko Dedic scored on the half-hour before Maltritz (75 and 78) sealed the win.
German Cup quarterfinal draw
Last season's DFB-Pokal finalists Borussia Dortmund and Bayern Munich were drawn together in the pick of the quarter-final ties.
Jurgen Klopp's side memorably secured a 5-2 win in last season's showpiece to complete a league and cup double.
Dortmund's hopes of repeating the feat have been undermined by falling 12 points behind Bayern in the Bundesliga this term and they must now travel to Munich in the last eight of the DFB-Pokal.
"We accept it, even though we would have preferred a home game," Dortmund chief executive officer Hans-Joachim Watzke told the DFB's official website.
Elsewhere, there was one other all-Bundesliga tie with Mainz to face Freiburg.
Third division Kickers Offenbach will be at home to Wolfsburg while Stuttgart host second-tier Bochum.
The ties are due to be played on February 26-27.