fruit flies have been living with people as long as cats,
dogs, rats, etc., in our neighborhoods on garbage, vineyards,
anywhere they find our rotting vegetables and fruit.
they have a really good sense of smell, over long distances,
and will invite themselves in from the neighborhood to join you
in your meal of decaying fruit. And they can hitch a ride
home on your groceries from the supermarket.
-- gilbertd at bio.indiana.edu