As the water freezes, it wants to form a regular crystalline structure (ice). That means impurities like oxygen and other dissolved gasses are pushed away from the crystallization front into the remaining liquid. This means that the last parts of the ice cube to crystallize end up with most of the impurities. If you’ll take a look at your photo of the ice cubes, you’ll note that the parts of the ice cube that were at the bottom of the tray are the milky colored bits. That’s because those were the last parts to freeze. The ice cubes in your tray froze from the top downward, which pushed the contaminant air downward until it was trapped at the bottom and had nowhere else to go.