Most spaceships in "space opera" science fiction movies are badly designed.
Written science fiction is more likely to use better designed starships than movies and television, but includes many that use the wrong layout.
In most visual science fiction starships use some type of generated gravity aboard for convenience in filming scenes with normal weight instead of weightlessness. It is also common in written science fiction but not nearly as much, because writers don't have to worry about the extra expense and difficulty of depicting weightless conditions aboard ship.
If a space ship uses gravity generators to generate gravity aboard ship, the designers have considerable freedom, depending on the technical aspects of that highly advanced fictional technology, to arranged the decks of their ship.
In most space opera movies and TV shows the decks are arranged parallel to each other so that some are "above" or "below" other decks. Thus one part of the ship's hull is more or less the "top" according to the internal gravity and the opposite side of the hull is more or less the "bottom" according to the internal gravity.
And that seems like a reasonable way to arrange the internal gravity and decks of a starship if it is technically possible to generate gravity that works like that. So far so good.
But where most space opera movies and TV shows, and many written space operas, goof up is arranging the their space ships like sea ships, with the decks running in the direction that the ship travels, and thus the direction of the generated gravity being perpendicular to the direction of travel.
Suppose that the space has to suddenly accelerate and decelerate by several times the amount of the generated gravity, which should be kept at 1 g for the sake of the health of human characters. Characters will be flung forward or backwards with a force of several gs. I remember a story where a character killed another character by turning on the propulsion while the other character was not strapped in a seat. And they were both in the relatively small control room.
Imagine walking down a long corridor facing fore and aft when suddenly, without warning, the spaceship accelerates or decelerates at several gs. You will suddenly find yourself in a vertical elevator shaft and fall to your death.
Items not tied down but instead held in place by the generated gravity will suddenly fly around and smash into other objects and people.
The Black Hole (1979) had a large space ship the Cygnus with a very long corridor. The Cygnus also had rocket engines at the rear. Whenever the rocket engines fired the very long horizontal corridor would become a very tall vertical shaft and anyone in it would fall to their deaths.
If a spaceship with that design accelerates or decelerates at several gs, the ship could compensate for that by increasing the force of the generated gravity it uses. But that generated gravity would be working at right angles to the g force from acceleration or deceleration and thus would turn the total g force acting on people and objects in the ship into a diagonal vector somewhere between pure horizontal and pure vertical.
But if a fictional starship is designed not like a sea ship but like a skyscraper building, being tall and thin with many decks one above the other, and with the front and the top of the ship being the same part, and the back and the bottom being the same part, it would make much more sense.
The decks would be perpendicular to the direction of travel, and so the generated gravity would point toward the back/bottom of the ship and away from the front/top of the ship. The generated gravity would work in the same direction that the ship traveled. So if the ship accelerated or decelerated the strength of the generated gravity could be increased, decreased, or reversed, as needed to compensate for the changing g forces and keep the total force acting on the passengers a steady one g pointed downwards.
So a starship with generated gravity built like a skyscraper would probably be shaped like a very tall cylinder. The decks would probably be circular and relatively small, with many levels of decks.
So a fleet of space battleships would probably be a bunch of tall, thin cylinders, and probably be arranged in some sort of three dimensional pattern with all the ships in the fleet pointed parallel, with their fronts/tops pointed in the direction the fleet was traveling in.
Since the best type of battle is one where you can harm the enemy but they can't harm you, weapons range will be very important in space battles. If it turns out that Fleet A can damage the ships in Fleet B at a distance of up to 1,000,000 kilos but Fleet B can only damage the ships in Fleet A at a distance of 100,000 kilos or less, Fleet B will try to keep the distance between fleets at 100,000 kilos or less, and will head toward Fleet A to lessen the range if necessary, while Fleet A will try to keep the distance between fleets between 100,000 and 1,000,000 kilos and will move toward or away from Fleet B if necessary to stay in the proper range.
Presumably the total volumes of the two fleets in a space battle would be a small fraction of the distance between the two fleets, so that all the ships in a feet were firing at the enemy at basically the same distance, just as in the early 20th century battleship battles were fought at longer and longer ranges by fleets widely separated from the enemy fleets.
And the hypothetical thin cylindrical starships would keep their fronts or backs pointed at the enemy fleet in order to have as small a cross section as possible pointed at the enemy weapons to make as small and hard to hit targets as possible.
Most movie and Television space opera starships use the in my opinion inferior design based on sea ships, with the decks orientated in the direction of travel and thus with the generated gravity perpendicular to the direction of travel. Thus those in my opinion goofy starships have tops and bottoms which are not the same as their fronts and backs, but instead are perpendicular to their fronts and their backs.
So when those goofy starships fly forward they have four sides perpendicular to their fronts and backs, a right side, and left side, a top side, and a bottom side.
And it seems like there is no reason for two such spaceships traveling together to be oriented with their top and bottom sides pointed in the same directions. Two spaceships travelling side by side could have their topsides pointed toward each other, and their bottom sides pointed away from each other, or vice versa, and it wouldn't matter as long as they were far enough apart for their generated gravity to not interfere.
And if a starship coming from star system A happens to meet a starship coming from star system B in interstellar space, there is absolutely no reason to expect that their top to bottom axis would be aligned parallel instead of pointing in two different random directions.
If the two starships are travelling under power when they meet, their two fronts should be facing forward and thus toward each other. but if they are coasting through space with their engines shut off there wouldn't be any reason for either ship to keep its front pointing in the direction of travel.
I could probably imagine some sort of technobabble explanation for why typical space opera starships based on the designs of sea ships might all have their generated gravity pulling them in the same direction, but I am not fond enough of those goofy starship designs to suggest any sort of justification for them.