Because the genitive case expresses also parts, like 'some, any'. I can give you examples from Croatian (BCMS):
Popio sam vode.
Drink.perf.past.masc aux.1.sg water.gen.sg
I drank (some) water.
Popio sam vodu.
Drink.perf.past.masc aux.1.sg water.acc.sg
I drank (the) water.
The second sentence implies totality. You drank the water (in the glass). The first one implies some unknown quantity.
That's why in negative sentences, objects were often in genitive in older stages of Slavic, and often still are. You don't have ANY money. The acc would imply you don't have THE money (or A money, but this is not a real option). But gen can be generalized to all objects. In older literature you can read:
Djevojke nije vidio
girl.gen aux.neg.3.sg see.past.masc.sg
He didn't see any/some (also: the) girl
Why is genitive connected with 'some, any'? There are various hypotheses. It might be Uralic influence, for example, where the partitive case has a similar use.
It also explains 'need' + gen. You often need SOME water, SOME money. From such frequent use of the verb with gen it can be generalized to all objects of 'need'.