Bacterial biofilms are aggregations of bacteria at the solid/liquid or solid/gas interface, and are the most common form of life on the planet. Biofilms are capable of complex structure that includes both competition and cooperation, as well as inter-cellular communication. Biofilms are responsible for both positive impact (e.g. water treatment and chemical manufacture) and negative impact (e.g. Legionnaire's disease and corrosion of pipes) on human society. In this talk, we will develop a mathematical model for a beneficial biofilm system that is used to remove nitrates from wastewater streams. We will also discuss the numerical methods used to solve the model equations, which includes a combination of the level set method for capturing the location of the biofilm/fluid interface, and the extended finite element method for solving elliptic equations on complex geometries.