According to Newton, there is an attractive gravitational force between any two objects– pulling them together. E.g. the planets and comets experience an attractive force towards the Sun.

Moons and artificial satellites are attracted to their planets, and so are pulled towards them.

This gravitational force keeps them moving in curved paths called orbits. The Moon does not crash into the Earth, and the planets do not crash into the Sun because they are moving.