The most common insect to see crawling out of a sink drain is a small type of fly called a gnat. Different types of insect can come from the drain, and you can trace them to a set of similar sources.
Food left sitting in the sink attracts flies and other insects, which lay their eggs in it. Once you wash the food down the sink, the eggs can hatch in the drain and come out.
A clogged drain provides ample breeding ground for insects. Food backed up in the pipes is a source of food for the insects, and once their eggs have hatched, they will crawl out of the drain in search of more food.
A damaged pipe may have a small hole or crack in it that allows insects to come in through the drain and into the sink. This problem can be difficult to detect and may require pipe replacement.
Insects sometimes lay their eggs in houseplants and return to the sink in search of food, which may lead to the appearance of insects crawling from a drainpipe. Keeping the house slightly drier can help solve this problem.
Simple ways to stop insects from crawling around in a sink include not leaving food in the sink, pouring boiling water down the drain to kill any existing insects or using a pesticide approved for use in drains.