I have been taking an online course on the subject of the origin of life on Earth. This is a field of study that seems to be getting tantalizingly close to an answer. The field got a major boost back in the 1950s when two researchers conducted an experiment that showed when a mixture of certain gases (thought at the time to be similar to Earth's early atmosphere) were heated with water and a spark passed through the vapors, complex organic molecules were formed. It seems as if the pre-life chemicals have a predilection to combine into complicated configurations—all on their own, in the form of many different complex amino acids.
But the process of these complex molecules then taking the next steps into something animate, is another huge leap. Lots of research is going on and it is tantalizingly close to an answer, but the difficulties of the process are immense.
We do know that life arose very early in Earth's history. Our planet was formed some 4.5 billion years ago, and life appeared quite shortly thereafter—under conditions that most types of life today would be unable to tolerate. Life is tough, though. Given half a chance, it will thrive, and it did. Then it took a very long time (some 3.5 billion years) for life to grow past single-cell creatures. Only about 500 million years ago did multicellular animals appear on the scene, during what is termed the Cambrian Explosion.
What struggles did life encounter in its early days to stay alive? Current research suggests that life may have originated in various clement locations on our planet. I use the word “clement” in a relative sense here... all conditions on Earth were very harsh in those days.
Life may in fact have gotten started more than once and then earlier forms died out, before sustaining itself; in a sort of stuttering manner. It's also possible that different forms of life came into existence and that the kind of life we know today may have driven other forms extinct.
Then again, life may not have originated on Earth. Meteorites continue to fall on our planet from space, which contain complex organic molecules. Maybe life got seeded here from elsewhere in the solar system or the cosmos. The environment on Mars some 3-4 billion years ago was warm and wet. Maybe life arose there and traveled on a rocky space ship to Earth. We have fund several meteorites on the Antarctic snow that we know did come from Mars (due to their unique Martian composition), and some of their interiors appear to have had primitive life forms embedded in them.
As I wrote above, the more scientists learn about the origin of life, the more complex that beginning seems to have been. It may not be long before we've deciphered the story, however.