Good question. There are various theories.
But ultimately we don't know.
Yet.
Indeed. We don't even know yet what exactly 'life' is - there is no definition that encompasses all the things we agree are 'alive' while excluding all of the things we agree are 'not alive'. It would appear that 'life' and 'not life' is something of a false dichotomy - there is a continuum of phenomena which, when ordered in terms of how much like 'life' they appear, have 'non-living' things at one end, and 'living things' at the other, with a wide variety of 'maybe-living' things in between - from rocks, via crystals that 'reproduce' similar crystals, through prions and viruses of various complexities to bacteria. Or from skeletons, through fresh corpses, via comas and persistent vegetative states, to deep sleep and full wakefulness.
Life is just sufficiently complex chemistry; and chemistry is just sufficiently complex physics. Despite centuries of searching by some of the smartest people who ever lived, nobody has ever come close to finding anything that clearly denotes the difference between 'life' and a set of complex cyclic chemical reactions. And medical doctors still argue about how to tell exactly when someone goes from 'alive' to 'dead'. It's far from clear cut.
The questions 'How did life begin?' and 'When does life end?' are apparently good questions; But a close study of 'life' shows that in fact these are not yet coherent questions - they ask about something that is not well defined.
View attachment 16116
Where does 'yellow' begin?