Gravity is the main reason the Solar System looks like a neat, organized neighborhood instead of a chaotic mess. Every object with mass pulls on every other object. The Sun is so massive that its pull dominates, making planets and smaller bodies curve around it in stable paths called orbits.
An orbit is basically a balance between two things: an object’s forward motion (it wants to keep going straight) and gravity (it keeps pulling inward). The result is a curved path. Most of the time, that path is an ellipse—meaning the planet is sometimes slightly closer to the Sun and sometimes slightly farther away.
If you want a simple mental picture: throw a ball forward. It moves forward while gravity pulls it down, making a curve. An orbit is like that, but the ball is moving so fast that it keeps “missing” the ground forever.