The player's objective is the fulfillment of a goal which will benefit humanity on some scale.
Nice try troll. Almost got me.
On a serious note though, your argument is entirely flawed based entirely on the premise it defends two very specific games. There are hundreds of games, many of which have debatable guilt with the guilt of the opponents.
Also, using your own logic, you entirely justify a video game where you are an Taliban terrorist murdering hundreds of US troops- entirely justified because "they are trying to kill you."
So now you're pro-terrorism? Wtf?
Obviously, my point is that your point is weak. You try to justify violence and taking the lives of others, often innocent others, by perverting what it means to be a hero.
Meanwhile, real life is nothing like this fantasy. Since games are meant to be realistic, we can only assume that while no nazi is holding their hands up saying "please don't kill me" (which is a lie. there are certainly characters in video games which beg to not be killed, which the player is almost told by the developer TO kill...but I will just pretend you're right and none exist), there are nazi's who are not bad people, forced into a war against their wishes, who would gladly drop their weapons and surrender to the player- even tell the player "I have never hurt anyone and never even fired my weapon after training. Please don't kill me." However the player doesn't get the chance to even have this discussion. Why? Because the game is about murdering everyone without any thought.
Most "Heroes" in video games are psychopathic villains who just happen to be on the side which appears to the player as the 'good guys'. In cases like Call of Duty or Assassin's Creed, the 'good guys' don't exist, as they are just factions at war with each other. At war for often what is a rich man's reason. Petty disputes between kings.
Oh, you are suppose to kill these guys because they're the enemy. They're the terrorists. You're the good guy navy seal right? Don't EVER question whether or not the navy seals are doing immoral action on behalf of a murderous collection of authorities who are unknowingly committing war crimes over oil.
In your mind, you're a good guy for being a soldier- even if you are commanded to murder people on the side of good. So what determines good? Whether or not that soldier is western or middle-eastern? Whether or not you are part of the US or part of a weaker group? Who is to say the invading villains are not the player's group- the US? Murdering the people trying to defend their homeland or take revenge against the murder of their families.