We all know articles are very difficult for language learners because there are so many exceptions. But I find the following general rules go a long way to cover many of the uses. For the question that was submitted, I think Rule 2 gives an idea of why 'the' was used:
Rule 1: Indefinite articles (a, an) are used for previously unknown nouns that are being introduced into a dialogue or story and definite articles are used for nouns that have already been introduced (or are already known or are assumed to be known at the point of introduction to the conversation).
For example: I saw a cat. The cat was sitting on a fence. The fence was painted brown. The cat jumped off the fence when it saw a mouse. The mouse ran into a hole when it saw the cat so the cat didn't catch the mouse.
Rule 2: The definite article 'the' is used when something is unique or, in other words, there is only one of that object.
For example: The sun, the president, the queen of England, the capital city, and the moon
It is used for objects that are well known by many or most people, but it is true even when the hearer may not know the object:
A:Who's he?
B:He's the president of Korea. She's the CFO. He's the mayor.
This can be contrasted with:
A: Who's she?
B: She's a member of parliament. She's an accountant. He's an alderman.
This uniqueness can come by association:
A car crashed into a tree. The driver was seriously injured.
Rule 3: When we are speaking of a noun in general we usually leave the article out, and, if it is countable, use the plural form.*
For Example: I like cookies. This is talking about cookies in general.
However, if I say 'I like the chocolate chip cookies.' I am talking about specific cookies.