Q: When is an apple grouchy?
A: When it is a crab apple!
Apples are fruit, so of course they are never grouchy. A person who is grouchy thinks that everything is bad, nothing is right; they are irritable and complain a lot. The best example of a grouch is Oscar the Grouch from Sesame Street. Grumpy is a synonym for grouchy, so you could watch at Grumpy Old Men for more examples.
Crab apples are small apples that are typically wild, that is, they have not been domesticated to be bought and sold. (You can eat them, though.). Crabby is another synonym for grouchy.
This joke is funny because it plays with the word grouchy and it synonyms, like crabby.
Oscar the Grouch is one of my favorite characters on Sesame Street. Here is a compilation of Oscar the Grouch.