The original designs of the ship featured a spherical primary hull as this is the best pressure-holding shape (our space ship has a positive pressure of breathable air), so I think that might be the ideal shape for the main area as opposed to a square. The difficulty in the original sketches was that that big ball up front rather obscured the rest of the ship.

In the "real world" aerodynamics is not a concern, but symmetry of mass relative to vector of travel would be important. Bi-lateral symmetry (like an airplane) would not matter in space, but the basic symmetry of mass does make sense for any ship that makes use of anything resembling old-fashioned reaction-thrust (i.e., rockets, ion-drives). The ships of
The Expanse get this detail right.
Star Trek is premised on the idea of 2 warp engines creating a warp-field for faster-than-light flight, so we may excuse the bilateral symmetries of so many ships in this 'verse. Also, warp fields may have warp dynamics resembling aerodynamics, so there might be some in-universe logic for the smoothness.
Again, I think that the chief design principle is utopianism. Humanity has "made it." We've grown up (or we're nearly "grown ups"), and so the ships show a utopian elegance. The ships are elegant because a utopia should be elegant. The Enterprise D, for example, exudes the sense of aesthetic concerns balanced with practical concerns. The ships curves blend into each other gracefully.
This is humanity expressing the notion of form meeting function as a sort of statement about humanity (as opposed to the brutalist architecture of the Borg which has no sense of "pretty," but only "practical"). Federation ships, I think, should appear to be practical (having propulsive bits, and habitation bits, and so on), but should also be elegant, unhurried, and unified (not greebly, kit-bashed, or weathered). The Borg, on the other hand, are just all about business (they're not here to sell you on any cloying optmisitic idealism by signing you up for a popular club of planets in a space bureaucracy and they're not trying to scare or otherwise impress you). They are here to assimilate you, so it makes sense that their ships are squared off with pipes and bits scattered around. The squares make sense. The Borg is brutalism.
The trouble with Trek is that it has been around for so long that there is this sense that the designs are a bit tired and need to be spruced up (e.g., the giant nacelles of the JJ-Prise, the barrel-rolling pizza-cutter that is Discovery, the super-busy Neo-Constitution class in Picard), but I find that the best shapes exude a simple elegance, like an old Jaguar or Ferrari.