The opening is defined by the moves of both sides.
confusion with opening names

Yes. The Berlin Defense to the Ruy Lopez is very different than the Berlin Defense to the King's Gambit or the Bishop's Opening.

White is playing the Italian Game
Black is playing the Two Knight Defence
White is playing the Ruy Lopez(Spanish Game)
Black is playing the Berlin Defence
They are different position's. So they have a different name.

The two openings are way different from each other, so it would be silly to assign them the same name.

When I first ever looked at an opening book and saw the "Sicilian" I thought of it as the "Silicon" for some time after and thought that sounded reasonable. Perhaps it was because I'd seen the "Stonewall" and thought that openings had to be named after rock formations or similiar...
An old joke at our club was regarding the pronunciation of "Pirc". One player caused a few chuckles when he said quite innocently "I don't think you can beat the "Prick" as a defence..."

As far as I know in military strategy, the name does not change based on the other sides position. So why does it change in chess for what the other side's position is?

Here is proof based on your logic that the ruy lopez loses for white:
Based on the OP logic and the Metaphor Logic It seems like the Berlin is a tough nut to crack after all LOL.
A name like the two knights defence is sort of like an in between sequence that no one put a good name on. It refers to general standard positions (not just the Italian game) that black (the defender) has two knights out, hence the name. If someone invented game changing lines the name upgrades from 2 knights to something specific like the Berlin, or something based on someones name. Just like 1. e4 is called "king pawn opening" as no one person can claim its invention or development, however 1. Nf3 is usually called "Reti opening" as Reti popularized and invented theory on it (hypermodern chess opening theory).
I am sure in the military that there are plenty of things invented by anonymous that are either not important enough or is important but simply never had a good name on it, so it becomes something blend like the S2 formation or something.

Usually the purpose of naming openings is being able to shorten a game's presentation when talking about it, for example "I've played against that player and we had a Caro-Kann Advance variation where he went for a kingside attack". In this way the one you're talking to gets to know the position without the exact move sequence being pondered about. Some opening positions are regularly played and well known but are reached after a lot of moves so skipping the variation can be handy, ex. "We went into the Ruy Lopez Berlin endgame".

Chess openings aren't named like formations in sports. They are named by the moves of both players mostly because having something like two knights out doesn't automatically dictate the strategy in the game like a formation in sports would.

Chess openings aren't named like formations in sports. They are named by the moves of both players mostly because having something like two knights out doesn't automatically dictate the strategy in the game like a formation in sports would.
I disagree completely.
I believe people are confusing formations with strategy's.
A formation is a over all picture or design you are trying to achieve which will require usually more than 1 piece or person to achieve it.
A Strategy will be the individual's idea or plans both short term and long term to achieve the desired Formation--Result--Design--etc.
If you bring both your knights out you do so with a strategy because you could have moved your bishop instead or moved a pawn.
Whether or not you are aware of the strategy will determine if you are skillful in chess or not.
However, regardless of whether or not you know what your doing it is still irrelevent to your opponent becuase he should still think/worry/ on your move regardless.

As everybody should know, the chess openings are not given their names by some kind of central chess-naming authority. Over the last four hundred years, some opening variations have been named after the players who introduced or championed them (the Tartakower Defense to the QGD, the Nimzo-Indian, the Winawer variation); some have been named after the tounaments where they first came to general attention (the Cambridge Springs variation, the Scheveningen Variation). The Scotch opening was employed in a correspondence game between the Edinburgh and London chess clubs. There’s a lot of great chess history and tradition in those names, but they do not constitute a logical system of nomenclature. Both Chess Informant and New in Chess have worked out fully logical systems of opening designations that are similar to the system libraries use to categorize books, so if you prefer the name “E81” to “The Samisch Variation of the Kings Indian Defense,” feel free.
Oh yeah Mister I will raise your "E81" with a "E84" or "The Samisch Variation of Kings Indian Defence, Panno Main Line".
Just Kidding lol

As everybody should know, the chess openings are not given their names by some kind of central chess-naming authority. Over the last four hundred years, some opening variations have been named after the players who introduced or championed them (the Tartakower Defense to the QGD, the Nimzo-Indian, the Winawer variation); some have been named after the tounaments where they first came to general attention (the Cambridge Springs variation, the Scheveningen Variation). The Scotch opening was employed in a correspondence game between the Edinburgh and London chess clubs. There’s a lot of great chess history and tradition in those names, but they do not constitute a logical system of nomenclature. Both Chess Informant and New in Chess have worked out fully logical systems of opening designations that are similar to the system libraries use to categorize books, so if you prefer the name “E81” to “The Samisch Variation of the Kings Indian Defense,” feel free.
New in Chess uses common names for the opening in their classification. Hence, RL 7 is the Berlin Defense to the Spanish Opening (Ruy Lopez).

Usually the purpose of naming openings is being able to shorten a game's presentation when talking about it, for example "I've played against that player and we had a Caro-Kann Advance variation where he went for a kingside attack". In this way the one you're talking to gets to know the position without the exact move sequence being pondered about. Some opening positions are regularly played and well known but are reached after a lot of moves so skipping the variation can be handy, ex. "We went into the Ruy Lopez Berlin endgame".
Glex, Thank you for your comment.
I have noticed that a quite a few openings black's names are different based on what opening white has. For instance; blacks 1)...e5 2)...Nc6 3)...Nf6 is called the Two Knights Defense when white's opening is the Giuoco Piano, but when its played against the Ruy Lopez, it's called the Berlin Defense. Why is this? What is the purpose of the name change?