It is produced in the upper atmosphere by radiation from the sun.(Specifically, neutrons hit nitrogen-14 atoms and transmute them to carbon.) Land plants, such as trees, get their carbon from carbon dioxide in the air. The same is true of any creature that gets its carbon by eating such plants. Suppose such a creature dies, and the body is preserved.The C14 will undergo radioactive decay, and after 5730 years, half of it will be gone. So, if we find such a body, the amount of C14 in it will tell us how long ago it was alive. The method doesn't work on things which didn't get their carbon from the air.
That causes a dating problem with any animal that eats seafood. After about ten half-lives, there's very little C14 left.
So, anything more than about 50,000 years old probably can't be dated at all.
If you hear of a carbon dating up in the millions of years, you're hearing a confused report. Second, they rarely contain any of the original carbon.
We can't date oil paints, because their oil is "old" carbon from petroleum. And third, it is common to soak new-found fossils in a preservative, such as shellac.
It is also standard to coat fossils during their extraction and transport.
Acetone is sometimes used while extracting fossils, because it dissolves dirt.
In short, unless you have evidence to the contrary, you should assume that most of the carbon in a fossil is from contamination, and is not originally part of the fossil. The nuclear tests of the 1950's created a lot of C14.
Also, humans are now burning large amounts of "fossil fuel".
As the name suggests, fossil fuel is old, and no longer contains C14.