Is there a difference between czemu and dlaczego?
Not really. But some people may find "czemu" a bit more colloquial, also some people (Hi mom!) tend to think that it is 'worse' because it's a Russicism. (cf. Russian почему)
Does Polish distinguish between ‘as a result of what causes’ and ‘for what purpose’ like Russian does?
I don't know Russian, but in Polish you can use Dlaczego as both
as a result of what cause= Z jakiego powodu?
for what purpose= W jakim celu ?, po co? na co?
Po co? (or more colloquial na co?) are common in spoken language
Shouldn't dlaczego be genetive as it is preceded by nie therefore is a negative sentence?
Dlaczego is neither a (pro-)noun, nor an adjective, nor a numeral, so it's indeclinable.