Fillings are done to remove decay, and replace the affected tooth structure. It is called a filling because a new material fills a hole that is caused by decay from bacterial and plaque buildup.
Modern day techniques mostly involve treating affected teeth with bonded tooth-colored composite resin fillings. When caught early enough, cavities can be treated easily and painlessly. If not treated, decay can lead to tooth pain and/or infection, and the tooth would need a root canal treatment or extraction.