Can garlic or onion stored in the fridge help to sanitize? How to protect fridge from dangerous elements which can spoil stored food?
I have often heard claims that garlic has antibacterial properties when consumed. I haven't read any reliable sources which prove or disprove that, so it could be false. Even if it inhibits the growth of certain bacteria, the botulism cases caused by improperly stored garlic alone are an indication that garlic, unlike substances like pure ethanol, doesn't kill all bacteria. But even assuming that garlic has some antibacterial properties, it doesn't do anything for your fridge. Oh, and I have never heard these claims for onions - just because two plants are botanically related, it doesn't mean they have the same effect on living organisms.
Garlic isn't something magic which kills germs through its mere presence. You would have to get it in contact with them. As germs live on food, if garlic is indeed, as per our assumption, antibacterial, you would have smear garlic juice on each food item before packaging it, which is clear nonsense.
Luckily, you don't have to do that. There is no need to sterilize your fridge at all. It doesn't preserve food by killing bacteria; it preserves food by lowering the temperature to a point at which bacteria don't multiply, or do so very, very slowly. You don't have to rid of the bacteria present in food before you put it into the fridge, it will keep anyway for a reasonable length of time.
The only thing you want to do is to keep your fridge clean of spilled food. Bacteria multiply in food media. If you put a droplet containing bacteria on a clean, cold metal surface (like a fridge wall), they will fall "asleep" due to the temperature and eventually die of starvation. If you put them in that puddle of spilled pancake batter you didn't clean because you were in a hurry, they will start multiplying very slowly. After a few days to a few weeks, you will have a big bacterial colony in your batter puddle. And while the bacteria won't magically jump to any food items held in the same fridge as the puddle (airborne pathogens are pathogens people cough on each other, they can't fly by themselves), any physical contact of a food item with the puddle will result in contamination.
Bottom line: Keep the fridge clean on the inside with a sponge and some detergent, and you are safe from fridge-caused bacterial contamination. Your food can still spoil if held for too long time in the fridge, but there is no way you can prevent that except for methods which change the food a lot (e.g. canning, salting, or drying). Garlic will not help you in any way.