Planets are round because they have a gravitational field that pulls everything toward the centre of the planet. (This is why things roll down hills and not up hills!). Over time, the way to get everything on a planet as close to the centre as possible is to form a sphere. If you think about it, a circle is the only shape where everythin in its outside is the same distance from the centre point. The scientific name for this is “isostatic adjustment.”
However, small things in space – such as asteroids – can have very weak gravitation pulls. The pull is often not enough to dislodge the hard material the asteroid is made from. So these are often not round in shape, come in all sorts of weird shapes.