On the scale of planets, every known material is essentially a fluid. Build an Earth-sized cube out of diamond, and it will collapse under its own weight into a close approximation of a sphere. With that in mind, there are really only a few things that determine the shape of a planet. Structural strength? Nope. Surface tension? Nope. Magnetics? *Maybe,* if there were some insanely powerful magnetic fields involved. It basically comes down to gravity and centripetal force. Under most conditions, what you have is a blob of matter trying to condense down to a sphere, but being pulled into a slight oblate spheroid due to spin. If you jack up the rate of spin, the planet will become more and more oblate; spin it fast enough and the outer rim will reach orbital velocity and bits of the planet will start dripping off. But until that point, the planet will be basically just a flattened sphere.
A few years ago someone ran the numbers and found that if things were *just* right, you could have a toroidal (donut) planet.That would be definitely interesting, but while it doesn’t violate the laws of physics, it is vanishingly unlikely to occur naturally. Such a world would almost certainly have to be *built,* using technology and engineering far beyond us. This type of world would also need active intelligent maintenance in order to survive in the long term (and this probably means “historical long-term,” not “geological long-term”).
But another contender has stepped to the fore, the “synestia:”
This is a naturally occuring non-spherical world. But it is *not* an inviting place, nor one with a well defined surface. The idea is that early on in the development of solar systems, molten rocky worlds would get slammed now and again by giant impactors; hitting just right, they’d throw up a cloud of rock vapor that would form a funky shape that would persist on the order of a century. The heat of the vapor would help it maintain its shape; as the heat dissipates, the structure collapses, back down into a sphere.