The terms originated from classes that utilized too many attributes to be at maximum effectiveness. Paladins, Rangers, and some Clerics, who all take hits and cast spells, all have had a stigma of being "MAD" classes over the years.
The term itself generally comes from trying to maximize value from spending Attribute Score Increases. MAD means that their attributes are spread too thin. This can be seen easily when contrasted to the "SAD" Rogue or Barbarian.
Examples of SAD:
Many Barbarians, across most games of DND/Pathfinder will utilize Strength (which allows them more damage/accuracy) and Constitution (for health/defenses), meaning that they only need to invest in two separate attributes to maximize their gain. They are either increasing their health or their damage as quickly as possible. Their to-hit, or defense against being hit, improves in most instances, causing them to scale in power sooner than the enemies they are pitted against.
Similarly to a Rogue, who relies almost always on Dexterity for their skills, damage, and defenses. Due to many of them avoiding hits or using range, they have the benefit of not needing as much investment into Constitution as other classes.
Examples of MAD:
In contrast, there is the Paladin. They will utilize melee weapons (requiring Strength), need to frequently take a hit (Constitution) and will want to cast spells (Charisma). While they can do many things, they cannot improve their defense while still improving their damage output, unlike a rogue (who can invest into Dexterity). If they focus on casting (and Charisma), they cannot hold their own as well as a barbarian can (who could otherwise pick Constitution).
This is especially truer in older editions, where your ability to cast spells was more dependent on the stat in question (Charisma, in this example). As a result, many paladins opted to neglect one part of the archetype for the class, choosing spells that did not scale with the spellcasting attribute, or choosing to sacrifice damage for versatility. On the other hand, a Barbarian or a Rogue has no need to sacrifice anything.
Another way to look at it
is how each attribute point could be worth per character. A Rogue has two standard choices to improve for a standard Ability Score Increase, Dexterity or Constitution. Normally, Dexterity would have priority (around a 70/30 choice), but we'll say it's a 50/50 choice for simplicity. If he makes one choice, he's missing out on 50% of other power increase options.
A Paladin, needing Strength, Constitution, and Charisma, also picks a single viable stat. He is then missing out on 66% of the power he could have chosen.
While this does not sound like a great deal, this is stacked for every ASI that the classes would get, which can be a big enough deal for power scaling at later levels.
Numbers
Let's say you have two characters, with all ability scores being 13. One is a Barbarian, and the other is a Paladin. For the Barbarian to reach 20 in all relevant stats (Constitution, Strength), he would need a total of 14 ability score points.
Now, for a Paladin to reach the same, if he leveled his relevant stats (Strength, Constitution, Charisma) evenly, he would need a total of 21 ability score points, which is 50% more than what the Barbarian would need.
He could opt to not invest into one of them, like Charisma, but that would mean that he would not be advancing wholly as a Paladin; investing into Strength and Constitution is a possibility, but also basically what a Barbarian would do and play as. Considering many features of the Barbarian are designed around advancement into Constitution and Strength as a trend, a Paladin fully invested into Strength and Constitution may have better been leveled as a Barbarian.