寝耳に水 means “a bolt out of the blue” and is a metaphor for an unexpected event or news.
寝耳に水 literally means “water in a sleeping ear”, however, actually 耳 (“ear”) here really stand for “hearing” and 水 (“water”) is really referring to the “the sound of turbulent water”. In olden times, flood control was much worse than what we have now and sometimes people were surprised by floods at night while they slept - this is where the elements of “sleeping” and “water” come in. So we use 寝耳に水 when we are surprised by an unexpected event, news, or information, just like the flood would surprise villagers while they slept.
We do not use 寝耳に水 for a “good” unexpected event though. For example, if your friend told you that he/she is getting married and you said “寝耳に水”, it may sound like you were unhappy with his or her marriage plans. “Bad” unexpected events or news are more common for 寝耳に水. If your friend told you that he/she was moving to a foreign country and you’ve never expected it, then 寝耳に水 might make a good fit!
寝耳に水 has a negative connotation because it is used for a unexpected bad event or news. So, please be careful with which event or news you used it for! And 寝耳に水 is normally used as a noun, but some people may occasionally use it as an adjective like 寝耳に水な出来事.
I never expected that you would move out! I will miss you….
I never expected the earthquake that happened last night!