Planets orbit around the Sun as a result of gravitational pull, or the natural attraction, between two masses. Earth has a velocity that is perpendicular to the force of the Sun's pull, causing it to move in a circular fashion.
The source of planetary motion is the result of the formation of the solar system 4.6 billion years ago when a series of events put modern day planets into their current rotational force and pattern. After the Big Bang, leftover masses of hydrogen gas formed giant spinning balls that collapsed under the weight of gravity. This compressed the gas into large objects of solid matter spinning in a fast, circular motion. The Sun's large mass at the center of the solar system creates enough gravity to keep all the planets in orbit.
The solar system works at an equilibrium in which two opposing forces acting on the planets cancel each other out. Gravity pulls the planets inward, and the inertia and their orbit drive them outward. In this process, the gravity of the Sun pulls the planets into a curved orbit within the solar system and keeps them from shooting out into deep space. Just as Earth's gravity keeps its moon in orbit, the Earth orbits the Sun because of the pull of the Sun's gravity.