In a way, what you are asking is similar to asking why a computer opponent in a shooting game wants to avoid being shot by you.
If you drill down the amazing quantity of components, even in just Amino Acid formations and functions (not even counting RNA and the rest), the possible algorithmic outcomes for reactions to variable inputs of interactions is quite simply mind blowing.
yet we know from our own experience that there is something there [an experiencer] which does not want to be killed or suffer injury.
What is "killed" or "injured"? To what molecular cell structure?
The basic reaction that we observe on the cellular level is akin to a desire for boundary, containment, and solidarity within its unit.
The question, then, is regarding when looking at a cell; is it regarding death?
Or, possibly, instead is it regarding retention and not death?
Instead of "knowing" anything, the cell is running on a program of instructions that are saved and permeated into it (rna, dna, protein) which determine the type of reaction to have to alterations to its components.
This then, brings your question down to the subject of why dna has storage capacity at all.
But this is empty, because truly, it actually leads down to the simpler form: rna.
So the question becomes primarily: how does rna work, how did it come to be this way, and why?