The current best hypothesis is that RNA randomly developed and evolved. Some if it happened to be self-copying. If there are self-copying things, there will be lots of self-copying things - that's common sense. And a genetic algorithm fitness function. In an ocean with RNA, sometimes it will happen to bump into other bits of RNA and swap over. Sometimes they randomly get better at copying. Zillions of molecules and hundreds of millions of years is a long time for small chances to happen. We want genetic algorithms to run in seconds on a PC. Ones that run for millions of years in the Earth's whole ocean don't have to be nearly as good.
The Miller-Urey experiment demonstrated that chemicals we know as building blocks of life can come into existence by themselves in early Earth conditions. What we don't know yet is exactly how they got from there to cells, since we don't have a time machine to go and look. Scientists keep finding plausible stepping stones, though.