The cause of revolution of earth is the angular momentum which was generated 4.6 billion years ago when our solar system was formed. As the mass increases the gravitational force also increases, so sun being heavier has the highest gravitational field. This gravitational field pulls the planet towards itself but due to the velocity of the earth perpendicular to the gravitational field it revolves and since there is no friction in space it keeps on revolving. The rotation of the earth is caused due to the following reason, during the formation of solar system, the dust particle clouds started rotating due to the sun's gravitational orbit. As the dust particles collapsed due their own gravity which consisted of asteroids they started spinning faster due to the conservation of angular momentum same as when a figure skater brings her arm towards her body to increase the rotation speed. These asteroids coalesced to form planets and currently the inertia of the planet keeps it rotating on its own axis.