1958, used of various pessimistic aphorisms. If there ever was a real Murphy his identity is lost to history. Said to be military originally, and probably pre-dates the earliest printed example (the 1958 citation calls it "an old military maxim").
A rule that states, “If something can go wrong, it will.” An addition to this law reads, “and usually at the worst time.” The identity of “Murphy” is unknown, but the saying was first used during the 1940s and may have originated with members of the armed forces in World War II.
If anything can go wrong, it will, as in We may think we've covered all the details for the benefit, but remember Murphy's law. The identity of Murphy, if ever a real person, is unknown. Some think it alludes to (but was not invented by) a feckless Irishman named Murphy. [c. 1940]