They’re named fungus gnats because these bugs are carriers of mushroom spores. They come in contact with these spores because they’re attracted to fungi. When they land, their feet can (not always) spread the spores to your plant.