The moon orbits the earth once per month, and the earth orbits the sun once per year. This happens because all bodies with mass in the universe attract each other. The earth's pull on the moon keeps the moon in orbit, and the sun's pull on the earth keeps the earth in orbit.