I found fungus gnats flying around my kitchen the other day. They seem to be under control around my figs, so I wasn't expecting this. It turns out that they came from some basil herbs that we bought from the supermarket. These herbs were small live plants potted in some growing medium that apparently had some fungus gnat larva/pupae. They transformed to adults days after we got the plants.
I've seen this before from other potted plants/flowers, but never from herbs...
Jim