As the title says. Are both forms correct? Are there differences in meaning?
Would it work with, e.g., tun?
Ich habe nichts zum Tun
Technically, “Es gibt nichts zu essen” means there is nothing to eat, while “Es gibt nichts zum Essen” is also correct but with a second meaning. You could interpret “Es gibt nichts zum Essen (dazu)” with an implied “dazu”, as in there is no side dish — nothing extra. But that depends on the context and is seldom used.
As for “Ich habe nichts zum Tun”: zum is a contraction of zu dem. Alone as a sentence, it does not make much sense in German. I’m a native speaker and can’t really tell you the grammatical background here, but it is my feeling that something is missing in the sentence. If people were talking about a certain deed and somebody said “Ich habe nichts zum Tun zu sagen”, then it would mean, he has no comments on the deed of somebody else.
Nichts zum Essen only works because apart from essen being an infinitive, Essen is also a noun meaning meal. “Es gibt nichts zum Essen” = “There is nothing for the meal”, i.e. “There is nothing at meal-time”. In English you would normally specify the kind of meal and say something like “There is nothing for lunch.” Since in most plausible contexts there are no similar periodically recurring occasions for tun (doing), zum Tun cannot be interpreted this way. Lots of people still say it that way at least occasionally, but that’s a colloquial or dialectal variant of zu tun that is considered wrong in standard German.
Es gibt nichts zu essen.
es gibt nichts zum Essen.
are right, as essen is a verb and zu essen translates into to eat while Essen is a noun which could be translated into there is no food.
But you cannot do that with zu tun, as tun is a german irregular verb for do and there is no noun which is spelled tun. So in that case, only Es gibt nichts zu tun is right, which translates into There is nothing to do.