There are many reasons why fruiting flies are found in the house. The most common explanation is that there is rotting food nearby – fruit, vegetables, meat.
Possible reasons for their presence include kitchen sinks with food particles on them; unprotected garbage cans; improper disposal of pet feces; compost heaps; and animal droppings. A trapped fly will produce up to 40 more new ones every week! Fruit flies like fermenting foods (sugar). They like molds (in bread or potatoes); yeast (in dough or beer); some fruits, vinegar, etc.; spoiled milk products; old cheese; boiled eggs; pastries left uncovered on counters overnight.