Larvae of fungus gnats feed on algae, fungi and plant roots in the growing medium, I don't think they do a 'lot' of damage to mature plants, but can hurt seedlings and can spread disease. They thrive in moist environment, so not overwatering is a preventative. Also, you can lay a layer of sand on the top of your medium so the adult gnat cannot penetrate the medium and lay larvae. There are also products such as Gnatrol available or you might try h202 drench to kill the larvae. Another useful addition is the yellow sticky strips (the gnat likes the colour yellow) Good luck.