Gravity is a force that attracts a body towards the centre of the earth, or towards any other physical body having mass.
The gravitational force is the universal force of attraction that operates between objects. It is one of the universe's fundamental forces.
According to Newton’s universal law of gravitation, the force of attraction between any two bodies is directly proportional to the product of their masses and is inversely proportional to the square of the distance between them. Mathematical expression for the given statement
where, represents gravitational force, and are masses, represents the distance between masses and represents universal gravitational constant.
Earth's gravity comes from all its mass.
Earth's combined mass exerts a gravitational pull on all of your body's mass. That's what gives you weight.
You would weigh less if you were on a planet with a lower mass than Earth.
From the above statements we can conclude the cause of gravity is the mass of the planet and the distance between the planet and the body (that is under gravitational force).