The derivatives were based off of the value of the underlying bonds, which contained these sub-prime mortgages. Since they were unregulated, they were being traded like crazy and there were derivatives of derivatives. There were many times the amount of money invested in derivatives vs. the securities that they were derived from.
The derivatives were supposed to hedge against the rise or fall of the housing market, one type of derivative protecting against movement each way. Several of the financial institutions found themselves too strongly invested in one position versus the other and placed themselves at tremendous risk. Those are the financial institutions that failed.
That's the part I'll never understand. I'm no financial expert, but myself, my engineer friend, and my truck driver neighbor all recognized that there was a housing bubble and that it HAD to crash. My truck driver neighbor even talked about moving, but said he'd just wait 5 years after everybody defaulted and then get the homes for cheap. Now, if we can see that, how can the banks and everybody else not see it?
The underlying cause was undoubtedly the sub-prime mortgages, but it was greatly exacerbated by the OTC derivative trading.
There are quite a number of articles out there describing this, and I've heard that The Big Short did a good job of showing what was going on as well. I was in my MBA program a few years after the crash and and did a paper on it, as well as all of the deregulation that had happened that lead to all the risky mortgages and risky positions by the banks in the first place. It goes clear back to 1980.