Bayern, who won the Bundesliga for an eighth-consecutive season in June, also won the German Cup and Champions League to cap a memorable 2019-20 campaign.
They started this season with a thumping 8-0 victory over Schalke before adding the UEFA Super Cup to their trophy cabinet following a 2-1 victory over Sevilla in midweek.
However, they fell behind away at Hoffenheim on 16 minutes after Ermin Bicakcic opened the scoring, nodding in a corner at the near post.
It was 2-0 eight minutes later, before Munas Dabbur took advantage of a misunderstanding in the Bayern defence to race through and delicately chip the ball over goalkeeper Manuel Neuer. Dabbur's goal meant Hansi Flick was two goals behind for the first time during his tenure as manager of Bayern.
Joshua Kimmich halved the deficit on 36 minutes with a stunning goal and it looked like the comeback would be on for the visitors.
However, Hoffenheim continued to create chances and Andrej Kramaric added a third on 77 minutes to seal the victory.
As Bayern attacked, Hoffenheim sought to catch them on the break and, when Neuer brought down Ihlas Bebou inside the box, Kramaric stepped up to slam the penalty into the roof of the net to make it 4-1.
"It was clear it would happen at some point," Flick, who had seen his side play 120 minutes against Sevilla on Thursday, said.
"I don't blame it all on fatigue. We did not manage to play out our chances with more determination. Congratulations to Hoffenheim.
"I cannot accuse my team of a lack of will or commitment. We now need to put it behind us."
Hoffenheim manager Sebastian Hoeness added: "We remained dangerous throughout the match, defended our box really well. I am not surprised at all, the squad just showed what's in them.
"We'll celebrate today, but we should not forget Bayern played the [UEFA Super Cup] over 120 minutes on Wednesday."
The defeat snapped Bayern's 23-match winning streak and was their first loss since a 2-1 defeat at Borussia Monchengladbach on Dec. 7. 2019.