Do you have the habit of staying water and drink it at midnight?
But you should stop doing it, and here you can see why.
It has changed its composition, as well as the taste.
The water does not contain sugars and proteins so it can be easily targeted by microbes and to come to pollution. Still there is no explanation from which comes the strange taste in the water that stood overnight.
A large amount of dust and bacteria can be gathered in that glass of water.
When water is exposed to air it absorbs carbon dioxide and a small part of that CO2 is converted into carbonic acid. Therefore water exposed to the air changes its chemical composition. Its taste is changed, because the carbon acid releases one or two protons and is turned into carbonate or bicarbonate; it lowers the pH of water.
This does not mean that the water is bad but certainly have changed the taste after standing all night and gathering bacteria and dust from the air. I am sure you will think twice before you do this again.