My WAG is that the custom has begun since America was colonized. Here’s why:
Bobbing for a greased watermelon was (and might still be) a popular game in the South since time immemorial. You greased up a watermelon with chicken fat (or whatever), tossed it into the pond, sent the yung’ns in after it, and whoever came up with it won a prize of some sort. Obviously, this wasn’t strictly a Halloween ordeal (hypothermia), and was probably only done during the summer except in the deepest of the Deep South.
Since this fun game probably had its share of accidental drownings, it probably evolved into the game it is today. Why apples and not peaches, bananas, etc.? Apples are bouyant, their shape is conducive to biting, and their size makes it challenging (but not impossible) to get a good “grip.” Not to mention the fact that apples were abundant and cheap in rural parts of the country.
FUN APPLE-BOBBING STORY: At a church youth group Halloween party back in High School, the Youth Minister’s wife was in charge of the apple-bobbing area. However, she had this habit of pushing various people’s heads completely under the water and laughing hysterically as they came up soaking wet. When my turn came, sure 'nuff she pushed my head under the water. But being the wiseacre that I was, I managed to get a big gulp while I was under there. When I came up I gave her a nice big spray! hee hee hee (Of course, I’m probably going to Hell for that).