Because gravity acts pretty much in a straight line. As the swirling dust clouds collected into the earth, the particles acted on each other to form clumps, and the clumbs attracted to each other, then you end up with a nucleus of matter imparting a gravity field radially out from the centre. Things will be colliding with the nucleus from all directions with an equal probability and thus a sphere.