How can you discern which meaning of 怎么 as an interrogative should be used in a sentence? In Mandarin, 怎么 has three major meanings as interrogatives - how, what, and why. It is quite perplexing for me to understand which interrogative someone tries to ask in.

For example, when I posted in WeChat that my weather app predicted the today's weather terribly in Shanghai, my friend added the following comment:


  怎么又到上海了。


However, while I assume she tried to ask me "Why have you come to Shanghai again?", it can also be translated as "How have you come to Shanghai again?", which I will reply with "In flight".

Sometimes it is difficult for me to understand why this word has three interrogatives and which one is correct in the context. I also wonder why people don't avoid the potential conflict of meaning and instead just use a more easily recognizable word like 为什么 and 什么, if possible.

Or do Chinese people discern this difference pretty easily? Or is it completely dependent on the context? Any tips on discerning it better?
Ermm, you posted " that my weather app predicted the today's weather terribly in Shanghai, "

Which I presume to mean: "Today's weather in Shanghai will be terrible."

That is the context: The weather.

There is no reason for your friend to then ask how you got to Shanghai, that lacks coherence. Her or his comment:

怎么又到上海了。 means: 'How come we are getting bad weather in Shanghai again!'

怎么How又again到to上海Shanghai了。