Moral hazard occurs when an individual, entity, or society doesn't fully bear the risk or consequences of its actions. This is often mitigated by insurance, (government) guarantees, bailouts, etc. A person may (or may not) tend to behave differently when not fully accountable for their actions or when consequences are softened. Here are some examples.
Example 1: Insurance
Insurance is a common and acceptable example of moral hazard. It limits the risk of significant expenses in unfortunate circumstances, like car insurance for accidents. While a sensible person won't take unnecessary risks, awareness of insurance might lead to less responsible behavior (not fully bearing the consequences—moral hazard). This is evident, for instance, with employee-drivers. Not everyone treats others' property as their own; the insurance will cover a broken car...
Example 2: 2008 Crisis, Bailouts of Bankruptcies
It's said that "moral hazard arises..." from certain actions, like government or central bank interventions, "creating or increasing moral hazard, etc." The 2008 financial and economic crisis is a prime example of moral hazard. It spread like wildfire, starting with the mortgage crisis in America. Brokers were handing out mortgages to people on the street, earning commissions without much concern for the future default of some mortgages. This is a classic example of moral hazard, even though bank oversight mechanisms likely failed. If mortgage brokers used their own money, they probably wouldn't lend much or at all to the unemployed or low-income groups (but their employer would bear the costs).
Bad mortgages were then sliced into so-called structured investment instruments. Some of them were given high ratings by rating agencies, indicating low default risk. However, this doesn't excuse or absolve responsibility from those who bought them.
No one cared much about what was "inside" these investment instruments; they were traded globally, initially bringing handsome returns to investors. Investment firm managers, who are usually no longer owners of the firm today, prioritized short-term gains and earned hefty commissions. They didn't bear responsibility for the losses suffered by owners (shareholders). Their compensation was commission-based, encouraging them to take risks (disproportionately). The reward structure supported moral hazard.
Video: On the Crisis and Market Sentiment humorously and instructively
The following video by two British comedians called Long Johns brilliantly and humorously captures the beginnings of the mortgage crisis in the USA and the so-called market sentiment (the desire to buy or sell). Although it's satire, it may not be so far from reality at times.
Private companies can undertake risky operations, such as speculative purchases of the mentioned investment instruments, based on the belief that there will be an even bigger fool who will buy them (the bigger fool theory). At least if they fully bear the consequences of their actions, showing that the mentioned securities are worthless (private gains and private losses = capitalism).
The company owners (shareholders) lose money, and that's fine because they should have watched their investment better, and those entrusted with managing the company (professional managers). Moral hazard arises, however, if the state comes in to rescue the mentioned company – perhaps claiming it's too big to fail – using taxpayers' money (private gains and socialized losses). One can then expect responsible behavior from this company, or will it tend to "gamble" with the certainty of rescue if things go wrong? It raises the question of why someone should have the privilege of rescue while others are condemned to failure, and why someone should have the right to decide about it.
Example 3: Interpersonal Relationships
Moral hazard can arise in interpersonal relationships. For example, if a family has an irresponsible member who consistently spends their entire salary or incurs debts, and someone is always willing to financially help or pay their bills, it creates moral hazard. The individual may never change their behavior, and they may never learn to rely on themselves. Deciding to help or not is not easy; it depends on whether it's a one-time help – everyone deserves a second chance – or a rule.