Flies can arise from rotting meat through a process called decomposition. When meat or other organic matter begins to rot, it releases certain chemicals that attract flies. These chemicals include cadaverine, putrescine, and ammonia. Flies lay their eggs on the rotting meat, and the eggs hatch into maggots. The maggots feed on the meat and grow until they are ready to pupate. After the maggots pupate, they emerge as adult flies.