This piece explains it well I think. Basically, it's to do with gravity and because planets are so enormous, the gravitational pull is massive and the planet collapses onto itself.
Here it is explained better:
All objects experience self-gravity, a force which pulls their atoms toward a common center. As the mass of an object increases, so too does its self-gravitational pull. After it exceeds a certain mass, the pull gets overpowering to the point where the object collapses onto itself and becomes spherical. Little items — like, say, a banana or a lug wrench — can resist this fate because their self-gravity is relatively weak, allowing them to retain non-spheroid shapes.