I asked a friend the same thing a while ago. He seemed to think that it meant that the guy’s got big balls (meaning courage, of course). Here, in Toronto, during basketball games we used to have a commentator who would say, “onions, baby, onions!” and apparently(?) this has the same meaning. I’m not sure if this has any truth to it but it sounds reasonable to me and it’s purty darned funny to boot.
These findings appear to be significant. The 1919 book is History of Company A, 307th Engineer Regiment, 82d Division, United States Army, and it’s available on Google Books in full text. “How do you like them apples?” is on page 148, in the reminiscences section, as one of several standalone humorous quotations. The book provides the previously missing link between the phrase and World War I. There is no reference to “toffee apples” or mortar, so the World War I link falls short of showing that this actually was the origin.
I think it’s also significant that “like them apples” had a pre-existing history as a sort of standard usage error, and I have little doubt that it was at least a contributing factor to the phrase’s humor and initial popularity.
‘How you like them apples?’ almost certainly doesn’t apply to having big balls, but here in Calgary, having [balls the size of] onions also refers to bravery or guts.
To get kind of literal, I suppose we’re looking for a situation where you expect something good (tasty apples) and it turns out to be something bad. Grenades that look like apples works in that context, but looks like the timing is off.
The Fox and the Grapes isn’t quite as good a fit for the phrase as he never attains the grapes. He only assumes they’d be sour because he doesn’t get them. The comeupance of the phrase doesn’t really apply.