The water tubes in an ice maker stay clean because water normally flows through them when being used. If the water gets turned off or sits in the tubes without being used for 6 to 12 months, it can change color. If the water at the other faucets in your home is fine and you have put in a new water filter, you might need to replace the water tubing that goes to the ice maker to fix the issue.
The ice maker tray may have a protective coating that can wear off over time. If you notice pieces or chunks in your ice, take a look at the tray. If the coating on the tray is corroded and peeling away, it could be getting into your ice. When this happens, bits of the coating end up in the ice cubes. To fix this issue, you will need to replace the entire ice maker.
The ice maker uses the same water that comes into your house through the main line. Sometimes the water can get dirty from things like a fire hydrant being flushed or a water main breaking. When this happens, the dirty water can get into your ice cubes. To fix it, run the water from your faucets for a while to clear out the lines. Also throw away any ice made during the time the water was dirty. Once the water runs clear at your faucets, the ice maker will start making clean ice again.
Dirty ice could mean old residue from your water filter is getting into the ice maker. Water filters need to be replaced every 6 months to properly filter the water. If you have an old filter, bits of residue can break off and contaminate the water going to the ice maker. This results in dirty looking ice cubes. To fix this, put in a new water filter and discard any ice made with the old filter.