Of course, we all know that's an illusion. Spontaneous generation was proved wrong ages ago, at least in the way we used to understand it. Nowadays, it's back. Now, it's an accepted theory. After all, life wasn't around when the Earth formed 4.5 billion years ago. So, it had to arise somehow from inanimate matter (because this is a scientific foray I will not comment on biblical origins).
We came to the belief that as the Earth cooled, a primordial soup or muck arose which contained the building blocks of life—small organic molecules. Spurred on by heat, radiation, and electricity (lightning), more complex molecules were produced over a span of about a billion years. At some point, these molecules started to replicate themselves and before you knew it, a couple of billion years more and here we are.
Of course, there's no proof. You could say we are the proof. But the mechanism is not quite clear. Stanley Miller and Harold Urey ran some experiments in the 1950s (illustration) which did yield most of our amino acids, building blocks of proteins. Subsequent experiments also found nucleic acids. So we were quick to conclude that's probably what happened. But wait.
There is a slight problem here. Many of our biochemical reactions involve the loss of water (H2O) in order to produce more complex molecules. These reactions are called dehydrations. I'm sorry, but there's just no way dehydrations will occur in a primordial soup. Seeing this as an issue, some scientists pointed at the possibility that life originated in the air. They proposed that early Earth's atmosphere was loaded with particles (due to constant bombardment by chunks of asteroids and such), and these particles could have carried some soup, dried out a bit, and produced the more complex molecules necessary for life. That's quite a stretch.
More recently, we've been fascinated by comets (and asteroids). Comets, in particular, are of interest because they are made of ice and dirt, and contain organic molecules. So now, the more popular theory of the origin of life on Earth is that comets carried the stuff of life to our planet. Now, that doesn't really explain a lot, since we are left asking, "But where did the comets pick up life's molecules?"
The Kuiper Belt (a shell of bric-a-brac existing beyond the orbit of Neptune) is chuck-full of dirty ice and contains the leftovers of the formation of our solar system. At least that's we think right now. But there's the conundrum. If these chunks are leftovers, how is it possible that they carry life's building blocks? Yet they seem to. The latest probe, Rosetta, which visited Comet 67P/Churyumov-Gerasimenko found water vapor, carbon monoxide and carbon dioxide, along with smaller amounts of carbon-bearing organic compounds, including formaldehyde and glycine, the simplest amino acid.
I would suggest that the mystery deepens. It's clear that organic molecules are formed under a variety of conditions. It's as if atoms and molecules were designed to interact and to become complex. Maybe that apple core did create flies.