Simply by having mass. Gravity is a property of mass, and every speck of mass in the universe is attracted to every other speck of mass.
Well, because earth is large (mass), we are able to have gravity. Some of it also comes from the moon and the sun pulling us
The Earth generates gravitational force due to its mass, which creates a gravitational pull according to Newton's Law of Universal Gravitation. The force depends on the masses of the objects and the distance between them, causing phenomena like weight, falling objects, and orbital motion. Gravitational force acts over great distances and is crucial to the movement of celestial bodies.
;