Hi
The moon IS attracted to the Earth by gravity. It orbits around the Earth because the pull between the Earth and the Moon balances the outward centrifugal force of the moon's motion. If the Earth did not attract the Moon, it would fly away into space. If the moon suddenly "stopped" in its orbit, it would be pulled into Earth by Earth's gravity.
Similarly, the Sun's gravitational force attracts the Earth and keeps us in orbit around it. Asteroids are attracted by Jupiter and Mars, but the gravitational pull from the Sun is MUCH bigger.
Paulett