This is an active field in science – people are still researching this. Amino acids, which are a type of chemical crucial to life, can be formed in the laboratory by experiments that try to reproduce what it was probably like back on Earth in the superdistant past. But I don’t know for sure what the current best theory is as to how these gave rise to life itself. But it must have been a very simple form of single-celled life to start with. Then evolution got going, and look at the wide variety of things that came about!
Sorry this is copied from a question I answered previously but hope this helps:
Things always have to start off with something simple that can be get more complicated. So:
Firstly, there would have been simple chemicals like that in the air, so Oxygen, Nitrogen and other chemicals that are more reactive (for example, formaldehyde and compounds that contain nitrogen and oxygen – do you understand what I mean by a compound?).
These simple chemicals would have reacted together to make larger compounds – for example, formaldehyde can react with more formaldehyde to make a sugar like glucose.
It is possible that these larger compounds could start interacting with one another but not necessarily reacting. In our bodies lots of chemicals interact with one another like enzymes breaking down a substrate but they do not necessarily form bonds so they are not reacting.
From here all you need to add is a cell membrane to keep all the interacting chemicals together, and this would be a simple organism, like a bacteria.
It all sounds very simple really, but it’s actually very complicated! This process would have taken millions of years. It is still very unclear how the simple molecules formed the complicated molecules that we find in our biology today. The fact that nature had billions of years makes this research very difficult as well as scientists do not have this time span! The reactions I do are on for days to weeks to even months, which is a very long time in chemistry!