There are several reasons for your ice cubes to taste or smell bad. See if one of the following will solve the problem.
Store food properly
If the ice making compartment is close to open food containers or spilled foods, ice cubes may absorb their odour. To avoid this, make sure to store food and liquids in sealed, freezer-safe and moisture-proof containers or wraps.
Replace the water filter regularly
Plumbed-in refrigerators use water filters that need to be replaced over time. Check the filter replacement indicator if your appliance has it or consult your user manual to see if it needs to be changed. If you’re having trouble finding your manual, download it here using your product’s model number.
Clean the water tank
If you own a refrigerator with a non-plumbed water and ice dispenser, it is a good idea to clean the water tank regularly. You can use clear, warm water to clean the water tank.