Genetic changes in the newly emerging species of Clostridium difficile (C. difficile) mean it has a sweet tooth that allows it to thrive in the sugar-rich Western diet.
It is also able to sidestep common hospital disinfectants and spread easily.
Scientists say the bacteria was primed to take advantage of modern healthcare practices and human diets, before hospitals even existed.
The gut-infecting bacterium C. difficile is evolving into two separate species, with one group highly adapted to spread in hospitals, according to a new study.
Researchers at the Wellcome Sanger Institute, London School of Hygiene & Tropical Medicine and collaborators estimate this emerging species started to appear thousands of years ago.
Able to cause debilitating diarrhoea, it is thought the superbug accounts for over two thirds of healthcare C. difficile infections.
C. difficile bacteria can infect the gut and are the leading cause of antibiotic-associated diarrhoea worldwide.
Published in Nature Genetics, the largest ever genomic study of C. difficile shows how bacteria can evolve into a new species.
The research indicates C. difficile is continuing to evolve in response to human behaviour.
It could help inform patient diet and infection control in hospitals.
Dr Nitin Kumar, joint first author from the Wellcome Sanger Institute, said: "Our large-scale genetic analysis allowed us to discover that C. difficile is currently forming a new species with one group specialised to spread in hospital environments.
"This emerging species has existed for thousands of years, but this is the first time anyone has studied C. difficile genomes in this way to identify it.
"This particular bacteria was primed to take advantage of modern healthcare practices and human diets, before hospitals even existed."
C. difficile is kept under control in a healthy person by millions of good bacteria, but antibiotics wipe out the normal gut bacteria, leaving the patient vulnerable to C. difficile infection in the gut.
This is then difficult to treat and can cause bowel inflammation and severe diarrhoea.
Often found in hospital environments, C. difficile forms resistant spores that allow it to remain on surfaces and spread easily between people, making it a significant burden on the healthcare system.
Professor Brendan Wren, an author from the London School of Hygiene & Tropical Medicine, said: "This largest ever collection and analysis of C. difficile whole genomes, from 33 countries worldwide, gives us a whole new understanding of bacterial evolution.
"It reveals the importance of genomic surveillance of bacteria.
"Ultimately, this could help understand how other dangerous pathogens evolve by adapting to changes in human lifestyles and healthcare regimes which could then inform healthcare policies."
Researchers collected and cultured 906 strains of C. difficile isolated from humans, animals such as dogs, pigs and horses, and the environment.
They sequenced the DNA of each strain, and compared and analysed all the genomes.
This led to the discovery that C. difficile is evolving into two separate species.
The researchers found that this emerging species, named C. difficile clade A, made up around 70% of the samples from hospital patients.
It had changes in genes that metabolise simple sugars, so the researchers then studied C. difficile in mice and found the newly emerging strains colonised mice on sugar-rich diets better.
It had also evolved differences in the genes involved in forming spores, giving much greater resistance to common hospital disinfectants.
Dating analysis revealed that C. difficile Clade A first appeared about 76,000 years ago.
But the number of different strains started to increase at the end of the 16th Century, before the founding of modern hospitals.
This group has since thrived in hospital settings with many strains that keep adapting and evolving.