The phrase "put (money) away for a rainy day" originated at least 460 years ago, and probably a lot longer, since you don't just make new idioms -- the audience wouldn't understand the reference. And the phrase was apparently understood all over Western Europe at the time, being used in Italian, French and English plays of the era.
But nothing I've found explains why a "rainy day" is what you should save for, instead of -- for example -- an "unexpected storm".