The element carbon can exist as a few different "isotopes" - all this means is that the number of neutrons in the nucleus can vary to give atoms that behave the same way chemically so are still carbon (since its the positively charged protons that determine this). A tiny proportion of natural carbon is carbon-14 (has 8 neutrons). This isotope is radioactive and decays at a measurable rate. The levels of carbon-14 in the atmosphere remain constant because the rate of decay is balanced exactly by new carbon-14 being made by the action of solar radiation. When a plant (or animal that has been eating plants!) dies, it stops taking in new carbon-14 and the levels start to drop over thousands of years. Because the radiation emitted by a sample depends on the amount of carbon-14 present in a simple way, we can use this to measure the amount of carbon-14 left. Comparing this to the amount in recently living samples, we can work back to find the time that has passed since the original plant/animal died (since we know the rate of decay of carbon-14)