Dental cleanings involve removing plaque (soft, sticky, bacteria infested film) and tartar (calculus) deposits that have built up on the teeth over time. Your teeth are continually bathed in saliva which contains calcium and other substances which help strengthen and protect the teeth. While this is a good thing, it also means that we tend to get a build-up of calcium deposits on the teeth. This chalky substance will eventually build up over time, like limescale in a pipe or kettle. Usually it is tooth colored and can easily be mistaken as part of the teeth, but it also can vary from brown to black in color.
If the scale, or calculus (tartar) is allowed to accumulate on the teeth it will unfortunately provide the right conditions for bacteria to thrive next to the gums. The purpose of the cleaning and polishing is basically to leave the surfaces of the teeth clean and smooth so that bacteria are unable to stick to them and you have a better chance of keeping the teeth clean during your regular home care.
Also it leaves your teeth feeling lovely and smooth and clean, which is nice when you run your tongue around them.