Researchers have discovered that the Streptococcus bacterium acquired its "flesh eating" toxic shock power after an infection of its own from a bacteriophage, a form of virus that attacks bacteria, about 30 years ago. The bacteriophage inserted a gene into a strain of the strep bacteria that allows it to take the human plasminogen protein and convert it into the protease enzyme. This enzyme destroys the human tissue, enabling the rapid invasion of the body that characterises the vicious nature of this strain of strep.
The mutation also produces an enzyme which allows the bacterium to escape capture and death by the host body's white blood cells, or neutrophils. This selects the mutated bacteria over their less virulent cousins without the gene. It's a gruesome example of evolution in action.