The myth that the Earth was flat persisted far longer than it should have. Philosophers and scientists suggested the Earth was round as far back as Pythagoras, or perhaps even further, and Eratosthenes even calculated its circumference with decent accuracy in the second century BC. It went on for centuries more, ultimately culminating in that most basic satisfying piece of evidence: the photos of the Earth as seen from space. Not even the most scientifically illiterate person could now doubt the facts. Earth is a sphere.
But why is the Earth, like all other planets, a sphere? Not to be evasive, but the simplest answer is: because they’re planets. When trying to come up with a mass threshold to differentiate planets from smaller bodies like asteroids, one of the primary rubrics is whether the body is massive enough to hold a spherical shape. So, there’s a giveaway: the answer is related to mass - and the most obvious force related to mass is, of course, gravity.
The reason planets are spherical is because the mass of the whole body creates a gravity well that is theoretically centered on the mass-center of the body itself. An irregularly shaped protoplanet, say with a lobe of heavy material sticking out in one direction, might have its gravitational center pulled away from the physical center of the shape. Over millions and billions of years, though, the strong pull down in all directions evens out those bumps.
The constituents of Earth might seem solid, but they are malleable under so much strain, and can flow like putty. In essence, gravity slowly deforms a planet to turn the gravitational center into the physical center. On a long enough timeline, the slow, even pull down the gravity well compresses a planet down to the most compact distribution around the center - in other words, a sphere.
Asteroids are often very oddly shaped with multiple lobes or jutting arms. This is because they are too small to create enough gravity to compress themselves down into a ball. Compared with the internal forces that hold matter together, gravity is very weak. A body must grow very large to exert enough gravity to overcome those forces. Many comets are much closer to spherical, however, because it takes so much less force to change the shape of ice than of rock.