The loss brought an end to Bayern Munich's record-breaking 23-match winning streak in all competitions, which began in February.
Ermin Bicakcic and Munas Dabbur gave the hosts a 2-0 lead inside the opening 25 minutes before Joshua Kimnich cut Bayern's deficit in half with a goal from outside the box.
Hansi Flick's men failed to mount a second-half comeback, as Andrej Kramaric scored a late brace to secure three points for Hoffenheim.
It's the second year in a row Hoffenheim have handed Bayern their first loss of the Bundesliga season.
The last time Bayern failed to record a victory was on Feb. 9 when they drew with RB Leipzig. Their last loss came against Borussia Monchengladbach on Dec. 7.