The moon orbits the earth due to gravity. This gravitational force of attraction between Earth and the moon provides the necessary centripetal force to keep it in a circular orbit around Earth.
The gravitational force of attraction between two objects is directly proportional to the mass of the objects. Earth is bigger and has greater mass than the moon. Thus, Earth exerts a greater gravitational pull on the moon. The moon also has linear speed, and it would continue to move along a straight line if it were not for the gravity of Earth. Earth’s gravity changes this linear motion into circular motion.