Living things take on carbon atoms from the atmosphere while they are alive. They stop taking on new carbon atoms when they die.
This is either in the form of plants that breathe CO2, and fix the carbon atom in their cells (releasing the O2 back into the air) ... or the animals that eat those plants, in which case the carbon atoms become part of the animal's body .. and so on up the food chain. Pretty much all carbon in a living organism's body started in the atmosphere.
Carbon atoms come in many forms (called isotopes). The most stable form is Carbon-12. Carbon-14 is a unstable form of carbon. Carbon-14 is replenished in the upper atmosphere when cosmic rays bombard Nitrogen-14 atoms and converts them to Carbon-14. So a small percentage of carbon atoms in the CO2 in the atmosphere are Carbon-14 atoms. We can measure the *ratio* of C12 to C14 in the atmosphere.
In a living plant or animal, we can verify that the ratio of C12 to C14 is the same as the ratio in the atmosphere.
Carbon-14 decays back into Nitrogen-14 at a known rate (half the C14 decays every 5,700 years ... called the 'half-life' of C14).
So once something dies, and stops taking on new carbon atoms, the C14 slowly disappears from its tissue.
So by measuring the ratio of C12 to C14 in anything that was once alive (bone, skin, leather, wood, paper, cotton, wool), we can compute how long ago that thing was alive.
The range of carbon dating is about 60,000 years. This is because 5,700 years is a relatively short half-life ... so after about 10 half-lives, there is not enough C14 left to measure reliably.
That is why carbon dating is NOT generally used for dating fossils or rocks (which is a surprisingly common misperception) ... but only one-living tissue (from bones and wood-tools to ancient parchments and shrouds). For older objects like fossils and rocks, we use isotopes with *much* longer half-lives ... like potassium and lead.