In German, every noun — person, thing, or idea — has a grammatical gender that fixes which article always goes with it. Many languages recognize two genders, masculine and feminine, but German has three: masculine (der, as in der Tisch: the table), feminine (die, as in die Suppe: the soup), and neuter (das, as in das Wasser: the water). If your own language doesn't have a neuter gender, this third category is the first real hurdle.
The deeper challenge is that a noun's gender is often arbitrary and won't match your intuition at all: das Mädchen (the girl) is grammatically neuter, not feminine, even though it clearly refers to a female person. No rule guarantees you'll guess gender correctly every time, so the only reliable fix is to learn every new noun together with its article from day one, as one inseparable unit — never memorize Tisch alone; memorize der Tisch as a single chunk.
The article itself also changes depending on the noun's role in the sentence — this is called grammatical case. When a noun is the subject performing the action, it takes the Nominativ case (the basic der/die/das you first learn): Der Kaffee ist heiß (The coffee is hot — coffee is the subject here). But when a noun is the object receiving the action, it shifts into the Akkusativ case: Ich trinke den Kaffee (I drink the coffee — coffee is now the object of drinking).
The good news: this Akkusativ shift affects only the masculine article and nothing else. der becomes den, and ein becomes einen, while feminine (die/eine), neuter (das/ein), and plural (die) stay completely unchanged between the two cases. So Ich möchte einen Kaffee (I'd like a coffee) uses einen because Kaffee is masculine and functions as the object, while Ich möchte eine Suppe (I'd like a soup) stays eine because Suppe is feminine and unaffected by the case change.
The most common mistake is forgetting this shift altogether and always using der or ein regardless of the noun's role, saying Ich möchte der Kaffee or Ich möchte ein Kaffee instead of the correct Ich möchte einen Kaffee. Many languages don't mark this kind of shift on the article at all in everyday speech, so the rule can feel unfamiliar until you practice it repeatedly in real situations, like ordering in a restaurant.