You still have to brush your teeth when fasting. Scrape all that plaque biofilm off your tongue. Plaque bacteria feed on all sorts of nutrients in your mouth and in your saliva, not just food residue.
It is not like I didn't brush my teeth. But the layer on the tongue was about 1mm thick, maybe more, and no amount of brushing it would remove it. It would only make my tongue hurt after a while, so i went back to regular brushing. Ketones may be the answer as the other reply explains, but one thing is for sure, having that foul smell in my tongue and nose at the same time 24 hours a day for 2 weeks is no party.