English speaker learning German and French and French through German. Roten?
"Apfel" is the object of the sentence, so it is in accusative case. For masculine nouns in accusative case with indefinite article ("einen"), adjectives have ending "-en." Hence, "roten." You can search the internet for tables about adjective endings. I think that memorizing them outright works better than trying to understand them through trial and error, since there aren't that many of them.