Entire books have been written on this subject, both about the specific 2008 crash and about financial panics in general, and one SE answer isn't going to cover the full set of categories of miscreants, or convey enough understanding of their misdeeds.
We can highlight a few, though.
Firstly you have the creation (or, well, enormous expansion) of the subprime mortgage segment of mortgage lending. This came from many corners and was enabled by major changes in the wholesale side of the business, but your core culprits were originators like Countrywide and Wachovia, who were incentivizing their salespeople to originate volumes of mortgages, regardless of the underlying credit profile of the borrower or the sanity of the valuation relative to an arm's-length appraisal of what the property was worth. A number of these mortgage brokers were taking someone's stated income instead of verifying it (so-called "liars' loans"), which would slightly impact the rate they got but not their ability to close the deal. Some of those were outright defrauding their underwriters in order to get a deal closed by any means necessary, coaching their borrowers to lie on their application, or even forging paperwork.
(there were many other categories of "bad loan ideas" too, where products were sold to people despite it being a bad fit for their financial situation: ARMs, balloon notes, reverse mortgages, the whole deal. But at the core of all of them were bad financial advice by people incentivized to tell you whatever was necessary to get the deal closed and make them a commission. And the fact that many of the borrowers never should have gotten approved for Loan X at Rate Y for Property Z.)
The mortgage brokers were encouraged to do so by their bosses, of course, who were making more money the more volume they moved. But wait, you might say - wouldn't the bill come due once the borrowers stopped being able to pay? Well sure, but that depends on who owns the actual loan, and receives the payments on it (or, ya know, not). For that we turn to the securitization process. An individual loan to a borrower of uncertain creditworthiness might sound like a bad idea. But what if we do this instead:
- We put several hundred loans all together in a pool. All those loan payments come into the pool, and then they go out in a very specific hierarchy.
- Let's say the loans were paying 5-7% interest. We'll say the first 60% of the payments in that pool get paid out to a "AAA" set of investors who get 4% interest. A few borrowers might default, over time, but obviously nowhere close to 40% of them, right? So that "tranche" is about as insulated from default as can be.
- Then we'll put the next 30% of payments into a "A-" tranche that gets 5% interest. In a terrible environment, you might get to where you're having some threats to the total payment stream (i.e. >10% default), but by and large, defaults need to be REALLY high for that to be threatened. So investment in that tranche is deemed "investment-grade", suitable for pension funds.
- This goes on down the spectrum, with some non-investment-grade tranches, and at the bottom is the "equity" tranche that gets whatever's left over. In good times, this could be highly profitable (note the differentials between the interest rates the borrowers are paying and the coupon rates you have to pay your senior tranches - the residual, if any, goes to that equity tranche), but in the bad times you lose your shirt. But in exchange for taking that risk, you're effectively insulating those senior investors from most of the risk too.
- Wall Street's big banks had / have a securitization desk that pools these loans, finds the buyers (often hedge funds, sovereign wealth funds, other groups that normally would never buy individual loans - so it increases the money chasing these products and bids down the interest rates), takes a commission... and they're done. They make money regardless.
So when the music stopped in this game of musical chairs, what happened was the investment-grade investors in these securitizations discovered that the odds-of-default implied by the credit ratings of the products they had bought were WAY understated. Not least because of how many of the mortgages had been fraudulently originated (see above).
But who was responsible for giving those particular tranches an investment-grade "A" rating, the kind that would let public pension funds and major insurance companies invest in it? That would be the credit bureaus, of which there are 3 big ones that matter (Experian, Equifax and TransUnion - if you've heard their names, it's probably for data breaches in the last few years). They are paid by the originators of these debt products, in order to slap their ratings on them so they can be sold. Conflict of interest much? Obviously you're not going to dig too deep beyond your normal underwriting standards if the people paying you are the ones who want the better ratings. So they ignore whatever red-flags might be underlying the loan pool being securitized, give it an investment-grade rating, and collect their fee. They still have not substantially reformed, BTW.
And then at the top of this house of cards are the credit-default swaps (CDS) that big banks and investors can buy to protect themselves from default events on their big fancy investments like these. The idea being, spread risk around the way that reinsurers do. The problem is, again, misaligned incentives - the people who should have been the guardians of financial sanity here were being paid commission based on the volume they moved. Your classic example here is Joseph Cassano of AIG, nicknamed "Patient Zero of the financial crisis". When the subprime borrowers stopped paying, and it hit the payment streams of the investment-grade tranches in the securitization, and these investors triggered their CDS insurance policies, who was holding the bag? AIG, to the tune of hundreds of billions of dollars. If they collapsed, with it might have gone much of the mortgage market, so along comes the US Treasury to bail it out - i.e., all of us end up paying, but they all get to keep their bonuses. (let's leave aside for now that Treasury ended up making money on a lot of their bailouts)
So if you want a quick rundown of greed and idiocy, it starts with the fraudulent borrowers egged on by the even-more-fraudulent originators, who themselves were egged on by their bosses as they sat around watching the money pile up. It was enabled by securitization desks at the big banks, who didn't care about the underlying loans because their job was to sell the pool. They were further enabled by see-no-evil credit bureaus and CDS desks, who were willfully blind at best, and outright frauds at worst.
Who went to jail? Just about nobody. The Obama Administration prioritized moving past the crisis and not angering Wall Street, for reasons both good and bad. Sometimes reputations were ruined for the principals involved. A good fraction of the population were outraged in general, including by the sheer fact that no banking executives were put on trial, but because they didn't have any concrete names to point to or entities to picket (many of the worst originators went out of business or were acquired for a song), it was hard to focus their anger and get prosecutors to change their stance.
Furthermore, since the victims here were (A) the taxpayer, and (B) the diffuse financial balances of a whole lot of people, but not in the form of things like bodily injury and death, there was not a huge drive by the relevant prosecutors to focus on trying these cases. Plus, the defendants would be wealthy and have a host of excuses, the topics were abstruse enough that it'd be hard to get a jury to follow everything, and at the end of the day you can convict a hundred drug dealers for the time and expense of pursuing one mortgage executive (and MAYBE getting a conviction, which they then fight on appeal for years more).
...but who was the greater drug dealer, when you really think about it?
"It is difficult to get a man to understand something, when his salary depends upon his not understanding it!"