No one knows for sure how life first appeared on earth, but somehow the elements and chemicals on Earth developed into single living cells.
These cells ate, reproduced, and died, leaving behind more material from which to make new life.
The single plant cells evolved into single animal cells, which not only ate, reproduced, and died, but found ways to move around.
From there the process continued until we wound up with people, New York City, video games, and spacecraft.
For a more detailed answer on the evolution of life on earth, check your local library for the thousands of books and articles debating this hot topic.