It is believed that earth is formed four and a half billion years ago from a huge mass of gas. A force pulls everything with the same power from the centre which is called gravitational force and this force is almost equal at every place on the earth. If this force was not equal everywhere then whole of the earth would have different sea levels and atmospheric pressure. So the things at the same distance are pulled with same force causing its spherical shape.
The particles or elements left all over in the solar system while some of them started attracting one another with gravity. They compressed themselves and formed a shape of sphere.
Earth is also not exactly round it is slightly bulging from the equator than the poles. The shape is formed due to the gravitational force and magnetic field made by spinning of object. Gravitational force keeps the atmosphere around earth and it’s spherical shape is formed by its rotational spins.
Gravity pulls all parts towards the centre and air presses equally on these whirling objects. When earth was in soft and molten state it has continuously whirled in space around sun. So earth got its spherical shape and it was hardened and cooled in that form.
If there was only water on the earth and whirling direction is continuously changing then our earth would have been exactly round and smooth. But it has rocks, water, soft rocks, etc which causes uneven friction.
So the calculation of combined centrifugal and gravitational force of earth shows that it is a sphere.