Gladbach led 1-0 after two minutes and 3-0 by the 21st minute.
Kouadio Kone slotted home his first goal for the club before Ramy Bensebaini swept home Jonas Hofmann's cross and then netted a penalty.
Breel Embolo took advantage of a defensive mistake for the fourth and then his second from Luca Netz's pass.
"I'm absolutely shocked. We simply didn't turn up," Bayern sports director and former player Hasan Salihamidzic told ARD.
"We were just not there. We did not win a single tackle or challenge in the entire first half.
"Everything that could go wrong went wrong. We let ourselves be outplayed in every situation - a collective blackout."
Gladbach scored with five of their six shots on target - with Bayern having more possession and more efforts than the hosts without scoring.
It was only the second defeat Bayern, who named a first-choice team, have suffered under Julian Nagelsmann and ended a run of scoring in 85 consecutive games.
Nagelsmann was at home self-isolating, having tested positive for Covid-19.
Bayern last lost a game by a five-goal margin 43 years ago when Fortuna Dusseldorf beat them 7-1 in the Bundesliga.
Their record defeat remains a 7-0 home loss to Schalke in the league back in 1976 - but this is their biggest defeat in a competition they have won a record 20 times.
Adi Hutter's Gladbach, who have lost four of their past eight games, are in the bottom half of the Bundesliga.
Story first published on BBC Sports