Fruit flies are attracted to rotted decaying foods but especially fruits hence their name. They will arrive on scene in places where they can find rotted fruits because the fruits are the perfect environment for them to lay their eggs in. They mate and then lay the fertilized eggs on the rotting fruit. After only about a day’s time the eggs hatch into maggots that will burrow down into the rotted fruit and when they emerge they will become fully grown flies.
After two days these flies become sexually active and they start the process all over again. Female fruit flies will lay hundreds of eggs in their short lifespan. If left to their devices they would multiply very rapidly but people usually make sure that they do not reproduce in or near their homes.