If we look at pictures of planets, stars or other celestial bodies, we soon see a resemblance between them: they are round.
Now one may wonder why this is so, why can’t we have cubic or pyramid shaped planets?
To understand what is going on here, we need to first look at gravity and learn a few things about the creation of celestial bodies like the Sun and planets.
When you take two small particles, and isolate them completely from the gravitational influence of other objects, then these two particles will start to attract each other. If you put down three or more, then each one will affect the other two, eventually causing them to clump together. (See 2nd picture)
No symmetry is really required, as all particles are being affected and will eventually clump together. The particles keep attracting each other, trying to get the tightest possible fit. (The longer the arrow, the weaker the gravitational pull.)
Now, if you have ever played with sand, snow or made cookie dough, then you will know that whenever you compress a handful of the stuff, it will form to your hand, if you then roll it around in your hands, spreading the pressure equally, it will form a sphere. You can think of your hand as pressure pushing on parts of the sand piece. With this we can explain how a sphere can be made.
Making a sphere is so easy, because all you have to do is apply uniform pressure to the entire surface, the more even the pressure is, the rounder your shape will be. You can picture this as a drop of oil in water. The oil is pushed on uniformly by the water, making the oil drop become a ball.
Now imagine gravity to be the opposite of pressure, so rather than having two giant hands pressing on the planet, you have a force uniformly pulling on the surface from the inside, giving you the same effect.
If you would try to make a planet in another shape, then it would have large areas where particles are further away from the center than others. If we take the cube for example, the points are a lot further from the center than the sides. So a planet in this shape would soon start to compress at the points and bulge at the sides to spread the force equally, slowly forming a sphere.
Now that we know that, we can shift our focus to the creation of planets and stars.
Our solar system, like any other, was formed from a large cloud of dust and molecular gas (Mostly hydrogen). This gas, being composed out of thousands of tiny particles and molecules then started to clump together into a ball, equalising the pull of gravity over the outer surface.
Just like an ice skater spins faster when he pulls in his arms, this ball of dust will do the same.
Increasing it’s rotation speed, it will also start to flatten off, just like a clump of dough can be made into a pizza bottom by spinning it around on your finger.
Eventually this forms into what we call a Protoplanetary disk, which is basically a large clump of dust at the center with an even larger ring of dust around it. As you might have guessed, the large clump at the center will become the star, while the ring will clump together into one or more planets (depending on its size and a few other factors.)
Now as you can see, planets and stars have a very similar forming mechanism, both depending on the clumping of loose particles, which as we have seen above will try to form a uniform sphere. However, when there is little dust and the mass of the object is small, an irregular shape can occur, this is why asteroids and small moons can be elliptical or irregularly shaped.
In fact, the larger the object is, the more of a perfect sphere it will form. The earth for example, is a perfect sphere, varying only about 0.5%. The Sun on the other hand has a maximal deviation of 0.1%.
So in conclusion, a large celestial body will always be a sphere, unless it is a newly formed clump that is still lacks the critical mass to be rounded by its own gravitational pull.