Mosquitoes lay their eggs in stagnant water.
Kerosene floats on water, so adding kerosene to water stops the supply of air to larvae preventing them from breathing.
Thus, it prevents malaria from spreading.