The term you want to look for is abiogenesis.
I will try to give you the Eli5 of the main theory, as far as I’m aware, of how abiogenesis happened.
First, you start with a soup of random chemicals. We’ve tested and seen that, with a reducing atmosphere and enough carbon and other elements present, things like amino acids and ribonucleic acids will just spontaneously form as a result of things like lightning strikes. At this point, they aren’t really life, just chemistry.
But, if you have a bunch of RNA nucleotides, they will tend to form chains of varying lengths. Some of those chains can act as enzymes, which basically just means they do something. Sometimes they can break other chains, sometimes they can build chains, and so on.
The other key element is, essentially, soap. Or, more accurately, lipids with a hydrophilic, or water-loving, end. They will spontaneously form bubbles. Those bubbles aren’t as good as modern phospholipids, the stuff our cell membranes are made out of, at containing what is inside them and keeping out what is outside, but that’s actually good for early life, because early life didn’t have any complicated machinery to do things like let necessary substances into and out of the cell.
So, you have these chains of RNA floating around, and you have these bubbles spontaneously forming. Sometimes, you will have a bubble spontaneously form around some RNA. Still not really a cell, at this point, but getting a little more complicated.
But, it’s close enough to being life that natural selection can start to happen. The RNA strands that are best at making copies of themselves, best at maintaining their bubbles, and so on will make more copies of themselves. And these protocell soap bubbles can, under certain conditions, divide into two without spilling their contents.
So, pretty soon, instead of just a soup of random chemicals, you have a bunch of little bubbles with RNA inside of them. And, the bubbles that are best at making copies of themselves, best at reinforcing their bubbles, best at absorbing other bubbles, best at breaking up different RNA strands so they can use the nucleotides, and so on will be the most numerous bubbles.
From there, protocells just get more and more complicated, get better and better at controlling their internal environment, and eventually are, pretty unarguably, life. Very primitive life, simpler than even the simplest modern bacterium, but capable of reliably reproducing itself, storing genetic information in DNA instead of RNA, using proteins to perform various functions, creating their own phospholipids, and so on.
But, if you break it down far enough, even a modern bacterium is just a lot of really, really complicated chemistry. Even you are basically a lot of extremely complicated chemistry. The universe doesn’t need to “know” what life is in order to make that happen.
Latest Answers