Like Sarah says, nails are made of keratin. Keratin can often be preserved in the rock record because it is so tough and it will sometimes fossilise and even preserve colour patterns (look at fossil dinosaur feathers!)
Keratin is made of oxygen, nitrogen, hydrogen and lots of carbon that make two strings that wrap round each other in a spiral and are conected by link made of sulphur. It’s pretty incredible stuff and eukaryote organisms (everything with complex cells like animals and plants) have been using stuff like keratin for over a billion years!
A biologist or chemist would say that fingernails are made from a protein called keratin produced by the cells on your finger. I’m a particle physicist, so I want to look at a smaller scale, and would answer that like all matter, keratin is made from atoms, which are made from sub-atomic particles: protons, neutrons, and electrons. Protons and neutrons are made from smaller particles called quarks.