Planets and their moons as spherical bodies. But smaller celestial bodies such as asteroids and comets are often irregular in shape and tend to look more like potatoes. Why is that?

The form of a body is determined by the interaction between its gravity and solidity. Small asteroids and comets have little gravity, which is insufficient to force their larger rocks into a spherical distribution. But the gravity of the significantly larger moons and planets is so strong, by contrast, that it turns these celestial bodies into spheres. There are, of course, still uneven features on the surface of planets, such as mountains and valleys, but they become smaller as gravity increases. 

Rotation – that is, the spin around their own axis – also plays an important role with regard to the shape of celestial bodies. The asteroid Cleopatra, for example, describes a full rotation in as little as 5.3 hours and therefore has the elongated form of a dumbbell: it is 135 miles long with a diameter of only about 56 miles. The large planets, too, are deformed through their rotation. The faster a planet rotates, the wider it becomes at the equator and the flatter at the poles. Our Earth is not a perfect sphere either. Its diameter over the poles is 26.5 miles smaller than at the equator.

Read more:

Vivekanand Vellanki
Good explanation