How Gnats Get into Your Refrigerator and Freezer
The most likely answer is that your fridge’s door gasket is malfunctioning. That happens when food debris gets in the way of the door’s gasket sealing as it should. However, that’s not such a big problem as you can easily clean it and the door should then seal properly. If you still see gnats inside your fridge after you clean it up there’s also the possibility that the gasket is old or damaged.
Another way that gnats get inside your refrigerator is if you put fruit with flies inside of it already. It’s easy for gnats to survive in organic material which includes food that is rotten. The gnats could also get into your fridge’s freezer through the vents in your fridge. There is no possibility for the gnats to survive the cold and that’s how you get dead gnats inside your fridge or freezer.
You can get rid of the gnats by placing an empty soda bottle in the fridge, with a little vinegar at the bottom. This way the gnats fly in and can’t get out. If you see, they aren’t seduced by vinegar, use something sweet like a juice.