These words are usually spoken when you have just comprehensively proved someone else to be wrong. For example, he might have said so-and-so is impossible and you then proceed to do whatever it is in front of his very eyes. Having done so, you could say: "How do you like them apples?" In other words, it's very similar to the playground taunt of "Na-na-na-na-nah-nah!"
thanks QM - I think you've just explained a line in the film "Good Will Hunting" (When Will says to the guy "I got her phone number, and you got apples")
hey htis was my question too. I saw the phase on a pop tart ad and then my friend said it but she made it sound dirty. now all the confusion is cleared, thanks guys! ;)