Because someone is doing something TO the sugar, that is, eating it. By itself, as the subject, it is der Zucker. If someone buys it, has it, eats it, or spills it, then the sugar is the direct object and not the subject, so we have to use the accusative form, den Zucker. However, that change is only with masculine nouns-- feminine and neuter nouns stay the same in accusative
True, but having a case chart at hand is extremely helpful until you nail it down.
The case a masculine noun is in determines whether to use den or dem. If it's in the accusative case and it's the direct object, den is used.
"Die Frau isst den Zucker."
Here, Frau is the subject and Zucker is the direct object that she is acting upon.
If it's in the dative case and the indirect object, dem is used.
"Die Frau gibt dem Mann den Zucker."
I couldn't really think of a good example where Zucker was the indirect object so I hope this sentence isn't too confusing. That being said, in this sentence Frau is once again the subject while Zucker remains the direct object. The woman is giving sugar, but to whom? In this case the whom is Mann which makes him the indirect object. That's why even though both Zucker and Mann are masculine nouns, one takes the accusative case which requires den while the other takes the dative case and requires dem. Neither use der because neither is the subject which would make the nominative case.
Just a reminder, this is for masculine nouns only. Feminine, neuter and plural each have their own rules.
Your problem isn't with the verb since eats/is eating are interchangeable. If you submitted "A woman eats sugar." and it was marked wrong (as it should have been), it's because you didn't include the article. "Eine Frau isst
den Zucker." should be "A woman eats
the sugar." or "A woman is eating
Okay, the simple version is that accusative case is used for direct objects— the subject is doing some action to the object: the subject buys it, eats it, has it, sees it, etc. Masculine accusative nouns take the articles den, einen while articles for feminine and neuter nouns don’t change.
This explanation goes into more detail. https://www.duolingo.com/skill/de/Accusative-Case/tips-and-notes
Can you give an example of when you used it and was marked wrong, or vice versa? That would help us see where you’re having trouble.