What happens when you get a cavity filled?

Good. The decay on the tooth is removed and the tooth is rebuilt to function fully again.
Health restored. A cavity is a rotted section of the tooth that will only increase in size if left untreated. Your dentist will remove the diseased part of the tooth and restore it will a filling to stop this process and restore the tooth to health.
Hole is filled. Basically, a cavity is a hole in a tooth caused by dental caries or tooth fracture. The dentist will remove (drill) the rotten tooth structure, provide some retention, attach a form to shape, then place a filling material (amalgam, resin, ceramic, or gold) to rebuild the tooth back to original shape. If cavity is very large, then the dentist may advise a crown to cover the tooth.