Unlike food, ordinary water contains no sugars and proteins that are targeted by microbes and easily polluted. However, the strange taste of the water that stood overnight had no explanation yet.
Numerous bacteria and dust have been accumulated in such water.
When water is exposed to air it absorbs carbon dioxide and a small part of that CO2 is converted into carbonic acid, which means that water exposed to the air changes its chemical composition. When carbon acid releases one or two protons and is turned into carbonate or bicarbonate, it lowers the pH of water and thus change its taste.
A glass of water that stood overnight is filled with bacteria and dust from the air. This does not mean the water has gone bad, but after all that has happened with it during the night you should think twice whether you should drink it or not.