What a filling is
The decayed part of the tooth is removed and the space is filled with composite resin mixed to the shade of your tooth. The resin is shaped to the surface, hardened with a light, and polished so it feels like the rest of the tooth when you bite together.
Why tooth-colored
Composite bonds to the tooth rather than sitting in it as a plug, so less healthy tooth has to be cut away to hold it in place. It also does not show, which matters more on a front tooth than a back one.
Replacing older metal fillings
Amalgam does not last forever. When an old filling cracks, leaks at the edge, or decay starts underneath it, it is taken out and replaced with composite.
When a filling is not enough
A filling works while there is enough healthy tooth left to build on. Where decay has reached the nerve, a root canal comes first. Where too little tooth remains, a crown does the job instead.