Gravity is the force that keeps planets orbiting the Sun in Newtonian physics. The Sun’s enormous mass produces a gravitational attraction that continually pulls each planet toward it.
A planet also has sideways motion, or inertia, so it does not simply fall straight into the Sun. The combination of forward motion and the Sun’s inward gravitational pull produces a curved path: an orbit. In a simplified picture, an orbit is like continuous free fall around the Sun.
Newton explained this relationship in the 17th century through his law of universal gravitation and laws of motion. Johannes Kepler had earlier described the shapes and timing of planetary orbits from astronomical observations, but Newton supplied a physical explanation. “Centrifugal force” is not the best answer here: it can be used as an apparent balancing effect in a rotating frame, while gravity is the actual central force in the basic Newtonian model.