Reading the wikipedia page for derivatives on 00:02 E.S.T March 21 2016, a credit default swap (CDS) is summarized as being "A credit default swap (CDS) is a financial swap agreement that the seller of the CDS will compensate the buyer (the creditor of the reference loan) in the event of a loan default (by the debtor) or other credit event", and goes on to say "It was invented by Blythe Masters from JP Morgan in 1994".
To a layman like me, this sounds very similar to a bet, and so it seems weird to say this concept was invented in 1994. In what way is a "credit event" distinct from something like a gambling event (like a dice roll or horse race)? Could the credit event be a person losing a bet that party A would win in game X?