That sounds like "Homer Goes to College" (S5xE3). There's a scene where Homer and a bunch of other students are in a large and packed lecture hall while the professor introduces the course material. The prof makes a pun and all of the students except Homer laugh. Just after that, the prof drops his notes and Homer laughs loudly and uproariously while all the other students stare at him in shock.
There are several clips of the scene on YouTube. If you search for "Homer laughs at professor" you shouldn't have much trouble finding them.