Would it ever be possible for computer viruses to evolve new "genes" to allow them to perform their job?
I suppose it would be possible in theory, but computer malware (viruses, worms, etc.) typically don't work this way today, and there are good reasons why they're written the way they are.

You might be interested in polymorphic code, which changes itself to evade detection.  It changes the sequence of instructions to some other sequence of instructions that will have the same effect, but will have a different binary.  This helps evade detection by anti-virus tools that are looking for a specific "signature" of bytes.  However, this is not the form of mutation you are asking about, because it will never cause the malware to "evolve" some new behavior it didn't already have.

Really, there is not much reason why malware authors would want or need their malware to evolve new functionality.  They can either build the desired behavior into the malware.  Or, they can have the malware contact a central "command &amp; control" server to download new code ("software updates" for the malware) periodically, to let them control the behavior of the malware.  Usually the bad guys work out offline what attacks they want to mount, and then implement this in the malware or command the malware to perform those attacks.

By working out the attacks offline, in advance, the attackers can test those attacks on their own systems and make sure they'll work properly and won't be detected.  From the attacker's perspective, this is a lot better than writing malware that randomly tries stuff in hopes it'll evolve to a useful attack; malware that tries random stuff will be a lot more likely to set off alarms and be detected.

So, there's not really any need or motivation for using "natural selection" in malware, and it's not typically seen in practice.