It depends. Are these spaceships taking off from planets? Because gravity and air resistance would favor the aerodynamic design you see in today's planes and the space shuttle -- less effort, money, and energy involved in achieving flight. And this is off topic, but it reminds me that I saw an electric car recently, looking just like a regular one, but there was no engine under the hood -- just an empty storage space. My guess is the design isn't necessary, but familiar and therefore easier to drive.
The Nostromo from Alien was about as un-aerodynamic as one can imagine. I assume that it was built in space and never really touches an atmosphere.
I think that kind of story would be absolutely fascinating! Sure, I'm an engineer and I'm probably more interested in that kind of thing than most people, but still, it's cool. Put a time limit on assembling the ship, put a few major obstacles in the way, make the hero the chief engineer on the project, and you've got gold.
As long as a ship doesn't have any special whiz-bang technology allowing it to overcome or outright bypass the laws of physics, unless the ship never has to worry about entering a world atmosphere, then you can assume a ship can be of anything in nature (design-wise at least). Bab5 taught me that!
Borg Cubes from Star Trek are about as un-aerodynamic as I've seen, and it's unlikely they land, since they have teleportation devices for getting personnel from orbit to the planet surface.
Despite not having to worry about friction in space there are inherent design benefits from using spherical shapes. The first aspect is that since there is air pressure inside the ship you have to have enough strength to prevent the ship from simply expanding, a flat shape would tend to bulge whereas a round shape is more easily strengthened to prevent that. The second reason is that you use less material for the surface structure for the amount of volume inside so there is an efficiency of material usage with a spherical shape. I would also think it might be easier to provide some sort of deflection shield system considering the nature of wave propagation if you had such a mechanism. Another consideration would be the ability to rotate a spherical ship to create artificial gravity, an odd shape would present dramatic differences in centripetal force all along the edges or any pathway that followed straight lines internally. And another less obvious effect would be when your ship crossed some sort of field, a round shape would present a better transition than something with sharp edges and corners, etc. So bottom line you can design it as you like and it might be a good Captain Kirk move to exploit the odd shape of a ship as a weakness in any story you create.
At very high speeds collision with even the smallest piece of material could be deadly. You need a very thick front shield and to minimize the risk of collision the cross-section should be minimized -> the ship should be a long cylindrical object with a strong peak-like front. Basically it needs to look like a needle. This applies only to high speed interstellar ships.
One also needs to remember in that once a race/species reaches a certain technological point, wouldn't such issues we're discussing have been figured out and overcome, thus granting the "Do whatever the heck you want?" styled designs?
I don't see any reason why it couldn't be rectangular shaped. When I picture this though, I picture a much larger ship, perhaps a mother ship. I wouldn't want to be zooming around in space at high speeds being blasted at in a rectangular ship, too easy a target. I also picture a ship that was assembled in orbit and does not do high speed travel (lights speed, FTL, etc.). I picture more of a warp space travel scenario, since it is faster and simply allows the ship to "jump" as opposed to actually travelling the distance.
I imagine there will always be design criteria for spacecraft and 'whatever the heck you want' will always be some way down the list. Minimizing costs might be quite high on the list. I imagine a large project would involve many teams of engineers, (who may never actually meet each-other) each working on a small part. The result would be a conglomeration of uncoordinated but functional features, a Frankenstein creation. Any kind of work in space would be horrendously expensive and often extremely difficult (if you create a large volume for people to live, how would you leak test it?). Living accommodation in space would effectively require a pressure vessel. On the Space Shuttle, the air pressure was 14.7 PSI. A cylindrical shape would cope with pressure without the distortion that would produce stresses. Flat ends of the cylinders would need to be of a stronger construction or of a spherical shape. On the Mercury, Gemini and Apollo missions, the pressure was 5 PSI of pure oxygen. The spacesuits used by Space Shuttle crew had 4.3 PSI of pure oxygen. Alternative shapes would be more reasonable with a low pressure, if you have a reason to make a different shape, and could overcome the higher risk of fire. Cylindrical objects sent up on rockets and fitted together would be a cost effective method to make anything large in space.
Not really. Think about it for a second (or three). If you have interstellar traveling technology at your fingertips, who is to say that the limitations that you and I (currently) know haven't been bypassed/solved? Often times, it's a matter of power. Power in the sense of the generation of it. As long as you have a strong enough power source, a race/species should have enough by sheer brute force (if not by an elegant design) to overcome the barriers than our current understanding of physics currently imposes on us. It's not really anything more than assuming that by the time a race of space aliens gets from Point A to Point B that they've solved the problems that has the human race sitting there scratching our heads dumbly.
A spaceship can be any shape in space, including rectangular. Big, real, interstellar ships will be built in space. Why fight the gravity well when you don't have to do so. If you have to worry about space dust and the like, shape is not the answer. You must have a shield, of a deflector field, something already in the works. A large, rotating donut is probably the best shape for centrifugal gravity, and has been used in a multitude of SF stories.
Aled James Taylor makes a great point about the loads involved. A rounded edge or body is far better at distributing a load than something with a sharp corner. From an engineering perspective, it would be far better to make something that is rounded because you don't have to include additional reinforcement.
Even a large cylindrical or spherical space ship is a problem once you get even slightly large. The pressure of any atmosphere pressing on the hull becomes huge if the whole thing is pressurized. One atmosphere is nearly 15 PSI, if you consider even a small surface such as a door 30" x 80", that is 2400 square inches, so one atmosphere would exert nearly 36,000 pounds of force against a vacuum on the other side. Now, if you really wanted square ships you could accomplish that by simply creating small interior spaces inside of it and not pressurizing the entire hull, but the practicality of that seems questionable.
The general principals of all forms of the maths and sciences involved here are generally correct. As long as we continue to use our current understanding of technology and\or the science behind it. Can we say that it will still apply the same way in 50 years? 100? As a result, I feel my point is still highly valid due to the unknown variables that are involved.
The OP asked about aerodynamics and further questioned whether certain designs could perform better. He is correct that aerodynamics is not necessarily a big factor, ignoring extreme high speed issues as several posters pointed out, but his other question is more definitively answered, yes it does matter. It won't matter how much you advance in technology, physics remains the same, a curved object is going to have strategic advantages over flat surface shapes. If you want square ships that is fine, but you are pushing towards fantasy science fiction rather than a more serious sci-fi, IMO.
In The Conquerors Trilogy by Timothy Zahn, the Conquerors had hexagonal shaped ships with ceramic hull plating. That could land on a planet, as well as breach the atmosphere. I believe the way he describes the ships to look like honey combs, flat on all sides. Not sure about the propulsion system off hand. So why can't a ship be rectangular? It can be what ever you want it to be. Hope this helps.
Eventually you need to refuel, and in Elite that's done with a fuel scoop and flying close to the sun.