Food is usually uncountable but it can also be countable.
When talking about the general concept of food, it is uncountable.
E.g., I ate a lot of food yesterday.
It is countable when talking about different, distinct 'types of' food.
E.g., I ate many different foods when I visited India. - I.e. I ate many different types of food ...
or Lots of the foods he eats are high in fat.
There are lots of nouns like this. When an uncountable is used as a countable noun, it is usually because you are talking about distinct examples, such as types/kinds of.
Coffee is uncountable but we can say:
I had two coffees this morning. - I.e., I had two [cups of] coffee this morning.
So it is actually the (usually) unspoken thing, such as types/kinds/cups, etc. of, which is countable.
Let me know if you would like some more examples.