Have you ever chopped garlic and then touched the ice cube tray without washing your hands? Guilty as charged. Your skin oils can transfer that stink directly to the tray. Then, even if you wipe it, the smell lingers like a stubborn houseguest.
Also, check your fridge’s air. Some refrigerators recycle air between the fridge and freezer compartments. If your fridge has a rogue garlic bulb, that smell can sneak into the freezer and tag your ice cubes like a game of olfactory tag.