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!'
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