The term “hazard” originated as the name of a gambling game which, at least in its later form, somewhat resembled the American game of craps.
The name itself is from the Arabic al zahr, the die. This became hasard in Old French, and the English borrowed both game and name shortly after the Norman Conquest, it would seem.
The game became very popular and was played for extremely high stakes in some of the most famous gaming halls of London.
The chance of great loss associated with hazard thus caused its name to become synonymous with peril, risk or danger.