In this case, the apple is a noun having something done to it. The thing that is being done to the apple is it's being eating by me, so it's now in the accusative case. Since it's masculine, it must change to 'Den Apfel' as do all masculine nouns in the accusative. 'Die Apfel! Ich ease den Apfel!'
I think it is "the apple" because we are speaking about a specific apple that we were talking about before the moment of speaking.
YOU RIGHT ABOUT "DER" IS USED FOR MASCULINE, BUT WHEN THE NOUN IS IN AN ACCUSATIVE CASE IT MUST CHANGE TO "DEN". THIS IS WHY "THE MAN" AND "THE APPLE" ARE NOT THY SAME. "THE MAN"="DER MANN", "THE APPLE"= DEN APFEL"..AS LIKE THE APPLE IS DOING AN ACT , BEENIG EATING BY THE MAN... I THINK