The Miller-Urey experiments and beyond
It turns out that Miller’s and Urey’s guess about the composition of the primordial atmosphere was wrong, yet the Miller-Urey products and many more products (including nucleotides) have repeatedly been generated in similar experiments that more accurately replicate the early atmosphere.
The salient point is that in a very short time, a variety of life-related chemicals will generate themselves from simple molecules provided that some energy is supplied to the system. Considering the billions of years before recognizable life appeared on the entire planet, it is clear that chemical evolution could yield cellular life. In fact, the earliest discovered microfossils date from about 3 ½ billion years ago, and this is a minimum 1 billion years since the origin of the planet.
Similar processes to those above must be occurring in the energy-riddled immensity of space, because many organic compounds have been identified spectroscopically in space and have been found in meteorites.