(For law as it refers to legal systems see Law)
A physical law is a scientific generalization based on empirical observations. It is different from a theory which is a framework designed to make predictions and to explain physical laws.
Laws of nature are different from legal code (see Law (civil)). Legal code is the creation of man, sometimes perhaps inspired by higher beings. Laws of nature are conclusions from scientific experiments.
Within most fields of study, and in science in particular, the elevation of some principle of that field to the status of "law" usually takes place after a very long time during which the principle is used and tested and verified. Though in some fields of study such laws are simply postulated as a foundation and assumed.
Mathematical laws are something in between: they are often arbitrary and unproven in themselves, but they are then judged by how useful they are in making predictions about the real world.
Examples of observed phenomena often described as laws include the Titius-Bode law of planetary positions, Zipf's law of linguistics, Moore's law of technological growth. Other laws are pragmatic and observational, such as the law of unintended consequences.