Murphy's Law is just a famous satirical statement commonly stated as : "Anything that can go wrong will go wrong".
Example on how Murphy's Law work: 'Going abroad for a vacation'
One can prepare for days for his/her flight and vacation but according to Murphy's Law, anything that can go wrong will go wrong.
The day of your flight, you might have overslept, had some car engine troubles while going to the airport, being held inside the airport, weather problems, etc... No matter how much you prepared, if there is even a possibility of 1% that a bad thing will happen, it will happen. That is Murphy's Law!
Obviously this satirical law is not always true. But it has been used often to describe a scenario in which one comes in fully prepared but still failed due to something that does not always happen.
And no! It is not a law in physics, it's mostly associated with the 2nd law of thermodynamics but it have been disproven by many.
Murphy's law states that anything that can go wrong eventually will. It is not a law of physics.
Murphy's law is named after one captain Murphy of the U.S. Air Force who worked as a design engineer at Air Force Research Laboratory in 1949. When there was an error in an instrument because of wires being connected wrong, Murphy voiced his frustration saying about the responsible technician that "if it can be done wrong, he will". Murphy's superior Colonel J.P. Stapp stated in a later press conference that because "Murphy's law" was being taken seriously and all possibilities of failure were being eliminated if possible, progress was being made in the tests. The term Murphy's law was popularized by the press.
The idea is behind Murphy's law is pretty obvious because the statistical likelihood of things going wrong in any possible way, however unlikely, can become significant when things are done enough times.
Murphy's law is more of a saying than an actual law and it has no basis whatsoever in physics.
It states that "Anything and everything that can go wrong will go wrong". This law itself has been around for a very long time, maybe even as long as man has been around, but it was only coined as Murphy's law in the 1940s by George Nichols after he had a bit of a falling out with Edward Murphy who was the reason the law was called Murphy's law.
The law itself doesn't really hold any scientific truth to it and is only useful as a sort of safety reminder or precautionary reminder at the back of people's minds when they're doing certain things, it's basically hoping for the best but expecting the worst.
Murphy's law has even been inverted and used to form yhprum's law which states that 'Anything and everything that can go write will definitely go right'. Murphy's law(Also known as Sod's law) and its inversions are more of mental and psychological laws. They aren't related to physics in anyway whatsoever
I hope this helps.