Multiple reasons, for one, it’s likely a frost-free freezer. That ice sublimates but leaves whatever nastiness was in the water at a more concentrated level. With all that air moving around the ice can actually absorb stuff. Your water may have also been dreadful to begin with. If there is a filter in the waterline it may need changing. Your waterline may be disgusting too. Do you have a bunch of stuff in the freezer like broccoli getting freezer burn? That makes nasty ice also. Sometimes a combination of all this makes ice inedible.
Wait, you’re not eating ice cubes from the trays but the shit building up on the sides because you don’t have a frost-free freezer? You don’t need science to tell you that will be nasty.