

The carbon comes from another source and sticks to the metal, you’ve probably already seen examples irl. If you burn something in a steel pan on the stove, then there will be black residue (char) left sticking on the pan. A burnt electrical outlet is another case, there the carbon comes from the plastic.
No, most coal comes from plants in swamps, because the water helped preserve the organic matter.
Plants in swamps die -> organic matter on the bottom of the swamp -> peat -> brown coal -> black coal.
Oil apparently comes mostly from plankton.
On the different origins: https://www.carboeurope.org/how-are-fossil-fuels-formed-the-science-behind-oil-coal-and-natural-gas/