The stable isotope of carbon, carbon-12, has 6 protons and 6 neutrons (adding to 12). Carbon-14 has two extra neutrons, and is unstable. Carbon-14 is produced at a fairly constant rate by the interactions of cosmic rays with the upper atmosphere, so while there are only trace amounts of 14C in the amosphere (as CO2), the amount seems to be stable over time.
As plants photosynthesize, they incorporate 14C into their cells, and animals that eat those plants then also get 14C.
Because of constant turnover of atoms in living things, the amount of 14C in living organisms is about the same as in the atmosphere. But once the organism dies, no fresh 14C is incorporated, and whatever is there will slower disappear through radioactive decay.
14C has a half life of about 5730 years, meaning that if you have 1g of 14C, after 5730 years half of it would be gone, leaving you only 0.5g of 14C.
Thus by measuring the concentration of 14C in a sample of organic matter, scientists can tell by how much remains how long ago the organism died. This works for things like cotton and wood as well as dead tissue, but does not work on rocks.
Because the amounts of 14C are fairly small, after about 60,000 years there is no measurable 14C left, so it is only useful for analysis of relatively recent samples, geologically speaking. It can't be used to get the age of dinosaurs.