Why the earth keeps on spinning?
Because it has rotational inertia. It's just Newton's 1st law applied to the rotational motion of a solid object. (In other words: It doesn't need a reason to keep spinning--that's what things do. But it would need a reason (a torque) to change its spinning.)
What about friction due to atmosphere??
Atmospheres are part of the planets that they're associated with, and as a basic rule rotate with them. There's nothing in space for the atmosphere to drag against. Winds are 'internal' phenomena of the system, caused by convection, and aren't reflective of the planet's motion.
Better the question-What initiated the earth to be in a state of spinning? Why did earth start rotating around its axis when it was formed? Can anyone here clear my doubt?
The coalescence of matter into a body will conserve the angular momentum of its individual parts. The Earth did not "start rotating", the Earth was a cloud of particles, rocks and gas, in a loose orbit around a cloud of particles rocks and gas that was to become the Sun and the rest of the Solar System. It was already rotating before it formed.
Where does the rotation come from in the first place?
1] Take two particles in empty space.
2] Give them each a random velocity in a random direction.
3] Place them close enough so that they gravitationally interact.
4] When they eventually collide, they will not exactly cancel each others' motion out (There is only a single, astronomically small chance of this happening - it requires both particles to collide with each other in a direct line, with no tangential motion relative to each other i.e. they were on a collision course to begin with). So, when they collide, they will stick together. They will retain any residual tangential motion that doesn't completely cancel out. This effect is cumulative.
Separate names with a comma.