The Earth spins on its axis due to angular momentum conservation. The Earth was formed when leftover gas from the sun condensed into planets. As the gas cooled, it condensed, which caused the Earth to start spinning. Because it is no longer condensing, the Earth will keep spinning at a steady rate and will continue to do so unless it is stopped by some external force.
Angular momentum conservation is demonstrated in the classic example of a figure skater. When a figure skater's arms are pulled in while spinning, the skater spins faster.
The Earth provides human beings with two things that are of interest: it spins, which causes day and night, and it exerts gravity, which causes objects to be attracted to the planet. However, the spin of the Earth does not cause gravity. Gravity causes the Earth to accelerate at 9.8 m/s/s (g) as the mass size of the Earth pulls equally on every kilogram of the mass on its surface. This number decreases as the distance between an object and the center of the Earth increases, causing a rapid fall in gravity. Zero gravity does not exist because a zero can never be reached by the division of a number.