The most common explanation is that in the 16th through 18th centuries in Denmark, Sweden, and the United States, poorer farming folk would pay their children's teachers with food - most notably with common and plentiful apples and potatoes. Another is that farmers gave teachers this food to supplement the teachers' low incomes; as teachers' wages went up, the amount of food went down. Eventually, students brought in that one apple out of tradition more than anything else.
Another consideration is that in the retelling of the story of Adam and Eve, Eve is said to have eaten an apple from the Tree of Knowledge. The apple is not actually mentioned in the book of Genesis; only "the fruit of the Tree of Knowledge." Regardless, the apple story stuck. Since teachers offer knowledge to their students, the apple -as the fruit of the Tree of Knowledge — makes the perfect symbol.
Some people point out that, when young children learn the alphabet, each letter is associated with a word they already know: A is for Apple, B is for Ball, and so on. So the apple is a symbol of the letter A, which is also the grade that most students want. So perhaps some students came to the conclusion that if they gave their teachers an A at the beginning of the school year, the teachers might return the favor and give them an A at the end of the year.
This type of early "kissing up" led to the term apple polishing, a.k.a. brown-nosing, or offering up gifts or false flattery in hopes of gaining favor.
Thousands of teachers receive shiny new apples at the beginning of every school year. Although they may have secretly hoped for an Apple iPod instead, this fruity gift is still appreciated. By giving your teacher an apple on the first day of school, you uphold a centuries-old tradition, make your teacher feel appreciated, and get the year started off right.