“Carbon dating” is one of the most misused terms when used outside of science. No one carbon dates a rock because rocks aren’t valid samples for carbon dating. The limit for carbon dating is about 50,000 years, so if you hear someone say that carbon dating returned a date of 10 million years then they are getting something really, really wrong.
Carbon dating can only accurately date organic material from the past 50,000 years, or so. Carbon-14 (14C) is continually made in the upper atmosphere as cosmic rays and other high energy particles bombard Nitrogen-14. Plants take up 14C in the form of carbon dioxide and make sugars from it. Herbivores eat the sugars in the plants, and carnivores eat the herbivores. Therefore, all terrestrial life has about the same 14C content in their bodies as that found in the air. When those organisms die they stop the turnover of 14C in their bodies. The 14C slowly decays over time, and we can determine how long ago something died by how much 14C is left. Since the half-life of 14C is only 5,700 years it can only be used over a relatively short span of time. It is also worth noting that aquatic life can derive its carbon from dissolved stores in lakes and oceans which have a different percentage of 14C than the atmosphere does.
One of the keys to 14C dating is historic levels of 14C in the atmosphere. The production of 14C can change, so dates have to be calibrated to these historic values. Luckily, there are known annual deposits that contain either atmospheric carbon or organisms which allows this type of calibration. Such records include ice layers, tree rings, and lake varves. Here is a graph showing the relationship between uncalibrated 14C age and the actual age of these objects:
As you can see, the actual age drifts slightly from the 1:1 line, and this is the calibration that is added to 14C dates.
The other source of possible error is contamination. If older carbon from the environment works its way into your sample then it will date older than it should. One way to check this is look at the overall carbon isotope makeup of your sample. Photosynthesis tends to favor the ligher isotope of carbon which is 12C. Therefore, if your sample is organic and not contaminated by inorganic carbon from the environment then it should be rich in 12C compared to inorganic sources of carbon.
Long story short, 14C dating can be accurate within a limited time span if done properly with carefully selected samples. In other words, it is just like the rest of science. It is a very reliable technique when done correctly.