The basic idea is that spacetime is like a flexible fabric, and massive objects (like stars, planets, and black holes) cause a "dent" or "curve" in this fabric. Smaller objects (like planets or light) move along these curves, which we perceive as the effect of gravity.
This happens because spacetime tells matter how to move, and matter tells spacetime how to curve. The more massive an object, the greater the distortion of spacetime around it. This warping affects both the paths of objects moving through space and the passage of time near the massive object.
In summary, massive objects distort spacetime because their mass bends the geometry of spacetime itself, creating what we experience as gravitational attraction.