The Earth is not rotating around the sun: but the Earth and Sun are rotating around a common point between the two which is really really close to the Sun. The same for all the other planets, but it gets even more complicated in that all the planets exert gravitational forces on each other too. So the Sun is pulling the earth towards it and Jupiter is pulling the earth in the other direction away from the Sun. This orbital system has taken billions of years to stabilise and settle down and is still evolving over time really really slowly. So there’s checks and balances that keep things stable. The planets are being pulled towards the sun, but the fact they’re moving in a circle means there’s centrifugal force flinging them away from the sun; as well as the force of all the planets acting on each other at the same time.
Just like the earth and the moon; The moon is slowly slowly drifting further away from the earth (about 3.8 cm a years). It was way closer millions of years ago and tides on earth were huge compared to today, but over time everything slows down as the earth spins ever slower and to preserve angular momentum the moon moves further away into a bigger orbit. Next time you’re on a merry go round (don’t give me that look; I’m 41 and I still do it) if you stand on the outside it’ll spin slow, if you step into the centre it speeds way up, step out to the edge again and it slows down. this is “conservation of angular momentum”, the tighter the circle the higher the speed, the smaller the orbit the faster it goes!