The story
The bite at the cherry form is the original. By the 1940s, cherry had taken on the additional meaning of "virginity" and the phrase was considered embarrassing, and so "apple" replaced "cherry" in American usage. The first recorded use of the "apple" form is in 1922.
Etymology from Wiktionary, CC BY-SA 4.0.