Question 1: is it the first time we mention it?
A or an introduces something new; the refers back to something we both know. I saw a dog. The dog was huge. Tell a short story and let learners notice when a becomes the.
Question 2: is there only one?
Use the when there is only one in the context: the sun, the president, the door (of this room). This explains why we say the kitchen at home without mentioning it first.
Question 3: are we talking in general?
English uses no article for general plural and uncountable nouns: Dogs are loyal. I love music. Many languages use the definite article here (Spanish los perros, la música), so learners say The dogs are loyal. This is the most common article error at B1 and above.
Then the fixed phrases
Some uses are simply fixed: go to bed, at home, by bus, in hospital (British) or in the hospital (American), play the piano. Teach these as chunks inside useful sentences instead of as exceptions to a rule.
A an, not a an?
A or an depends on the sound, not the letter: an hour, a university, an MBA, a one-way ticket. A quick listening game with these pairs fixes it fast.