
Isaac Newton in 1687 first realized that the force that makes an apple fall also governs the Moon's motion. In the 20th century, Albert Einstein showed that gravity is not just a force but curved space and time.
Earth attracts you because it is very massive. You also attract Earth, but your mass is tiny, so it's imperceptible. In space, gravity keeps the Moon near Earth, and Earth in orbit around the Sun.