If you consider one planet in orbit around a star, what happens is that both orbit around the common centre of mass - the star can also be considered to be in orbit, albeit it moves around much less, because the common centre of mass is a lot closer to it, than it is to the planet. The Moon-Earth common centre of mass is located actually inside the Earth - the Earth "wobbles" around it. The same is true of the Sun.
Why do things orbit? Linear motion plus a force with a normal component to the linear motion gives elliptical motion.