There was once a time when folks thought that mice grew out of old rags and flies came from food. It sounds like a crazy idea now, that animals could spontaneously appear from inanimate objects, but if you've ever been forced to deal with a fruit fly infestation, you understand how someone could've thought that fruit flies came from fruit. These tiny little bugs really can take over a kitchen, swarming any pieces of fresh fruit you might have sitting out, and they're so small and pervasive that it can be a challenge to really understand where the source of the problem might be. So where do fruit flies come from?
Fruit flies do not come from fruit itself, though they do ofter appear because of fruit. As Michael F. Potter, an entomologist at the University of Kentucky's College of Agriculture, writes, "Infestations can originate from over-ripened fruits or vegetables that were previously infested and brought into the home."
And part of the reason you might think fruit flies come from fruit is because fruit flies lay their eggs inside fruit. As the experts at Orkin, a national pest control and extermination company, explain, "The fruit fly life cycle begins when a fertilized female locates a piece of fermenting fruit or other source of fermenting sugar in which to lay her eggs. She can lay up to 500 eggs," under the skin of the fruit itself, "and male and female fruit flies mate as soon as two days after emerging as adults."
Those fruit fly maggots actually eat bits of the fruit to survive, so you'll be able to tell where the infestation is in your fruit because those bits will be decomposed. And that's why it looks like fruit flies are coming from the fruit you store on your counter, even though they don't just appear in the fruit. (But it also means if you store your fruit on the counter, and you've got a fruit fly infestation, there's a pretty good chance that you're eating fruit fly eggs. It's gross, I know, but that's life.)
The bad news is that you can still have a fruit fly infestation even if you don't store your fruit out in the open. Potter, the entomologist from Kentucky, writes, "All that is needed for development is a moist film of fermenting material." And because each bug can lay hundreds of eggs at a time, a single rotting food source can breed thousands of bugs, which only exacerbates the already annoying problem.
That's why the best—and really only—way to get rid of fruit flies is to get rid of any rotting material in your kitchen, and that doesn't just include fruit. The experts at Orkin write, "Fruit flies lay their eggs primarily in fruit, although they can also deposit them in drains, trash cans, spills and other sources of decaying, sweet, organic matter." So if you've got a fruit fly infestation, check the fruit basket, sure, but it's probably also time to do a deep clean of your trash can and kitchen sink, too.
Oh, and if you're freaked out about eating fruit flies, accidentally, don't worry. You can avoid eating fruit flies by avoiding the ripest parts of the fruit, and if you do somehow eat a bug, your chances of getting sick are slim. And hey, maybe you could think about it as an extra source of protein!