Jonathan Haidt said this quote

The emotion of disgust evolved initially to optimize responses to the omnivore's dilemma. Individuals who had a properly calibrated sense of disgust were able to consume more calories than their overly disgustable cousins while consuming fewer dangerous microbes than their insufficiently disgustable cousins.