Moral hazard is the danger of bad behavior that arises when people are insured against the consequences of that behavior, while adverse selection is the tendency that only the people who need such insurance most are willing to pay for it. Both of these issues increase the cost of administering the systems where they arise. Adverse selection creates a more costly participant pool. Moral hazard creates costlier behavior in those participants.
Adverse selection arises when you remove barriers to entry for a costly service, such as health insurance. When pre-existing conditions no longer bar entry to health insurance, only people with current health needs are encouraged to participate. Because health insurance expenses are paid for by the healthier participants in the system, enabling them to drop out increases the costs for the remaining participants, or the system itself, drastically.
Moral hazard arises when incentives for good behavior are removed. One example is paying a salesperson on a pure salary basis. When a salesperson does not earn a commission on any sales, this greatly decreases the motivation to maximize sales. The salesperson loses nothing in the short term if sales decline, and gains nothing if sales increase. While long-term consequences are likely, these do not have the same motivating power as immediate consequences.