The same tool – the carafe – is used in both cases, but the goals are different.
Aerating: Before serving a wine, it’s often a good idea to aerate it. This consists of quickly and vigorously pouring the wine – generally a young cuvée – into another vessel so it can stretch and breathe. The goal is to maximize the wine’s contact with oxygen. Aeration can’t hurt; in fact, many young wines will actually benefit from the practice.
Decanting: The purpose here is to remove any sediment that forms in older wines by gently transferring the liquid into a decanter or carafe. Start by standing the bottle upright for several hours, even a day or two, to allow any sediment to settle on the bottom. Before pouring, place a light under the neck of the bottle so you can stop when you see the sediment threatening to fall into the carafe. Only decant very old (and therefore fragile) wines just before serving to prevent their delicate aromas from fading.