When to use "der" or "den"?
Nouns and articles are conjugated according to the grammatical case we use. In your example the appropriate cases are:
Die Frau (Nominative) isst den Apfel (Accusative).
Still, grammatically it is possible to use different cases in order to express a different action:
Die Frau (Accusative) isst der Apfel (Nominative) = the woman is being eaten by the apple
With a female gender the singular article for nominative case and accusative case are the same.
See how the meaning changes with the following example:
Der Mann (N) küsst die Frau (A) vs. Den Mann (A) küsst die Frau (N)
It’s also noteworthy that the verb (_essen_ in this case) determines which case its object has to be in (and some can rule more than one object). The case of the subject of a sentence is always _Nominativ_.
They are not the same, but related. The answer is that the articles "der, die, das" are declined. You might have a look at the explanantion here (I don't know of any easier right now). In your example the line "Die Frau isst den Apfel" is the correct one. The article of "der Apfel" would change again if we would say "Die Frau isst den Kern des Apfels" (the core of the apple i.e. the genitive is used).
Even if the women eats a carrot (die Karotte), then the accusative is in use (although you can't see it because it looks the same as the "normal" (nominative) article: "Die Frau isst die Karotte".
Confusion around the articles are very common for non-native speakers, but thats not too bad since on most cases the meaning can be derived from context and people will still understand you.