Bayern, who face Real Madrid in the Champions League semi-finals next week, stayed on course for an unprecedented back-to-back treble having already clinched the league title.
However, the Bavarians, who have won the German Cup a record 16 times, have not enjoyed a good run since clinching the Bundesliga crown. They have slumped to a draw and two defeats in their last three league games.
“Kaiserslautern were very courageous at the start and we had problems with possession,” Bayern coach Pep Guardiola told reporters.
“It is not easy to score five goals no matter which team you are playing against.”
The Spaniard can now avenge their league loss to Dortmund and their German Super Cup defeat to the Ruhr valley club at the start of the season.
The visitors defended well from the start but they paid the price for their first mistake when Robben floated in a corner and Bastian Schweinsteiger was given far too much space in the box to head in.
Bayern, who lost 3-0 to Dortmund on Saturday, added another with Robben again the provider, cutting into the middle from the right in his trademark move before laying the ball off for Toni Kroos to rifle home after 32 minutes.
Robben earned a penalty five minutes after the restart and Thomas Mueller converted the spot-kick.
“The criticism in the past weeks was a bit too much,” said midfielder Kroos.
“It is only human to take your foot off the gas a bit when you have already won the league title. What is important is to peak when it matters.”
Kaiserslautern refused to surrender, however, briefly cutting the deficit through Simon Zoller’s glancing header on the hour before Bayern’s Mario Mandzukic struck 12 minutes from time to put the game beyond the visitors.
Goetze completed a solid Bayern performance with a close-range tap-in after a flick by Franck Ribery in stoppage time.
Dortmund, the 2012 Cup winners, booked their spot in the final with a 2-0 victory over VfL Wolfsburg on Tuesday.
(Reporting by Karolos Grohmann, editing by Ed Osmond and Pritha Sarkar)