Imagine talking about a student: you say "the student is studying," then later "I know the student." In many languages the word for "student" stays exactly the same no matter what role it plays in the sentence. German has a special group of masculine nouns that behaves very differently: the noun itself changes form depending on its grammatical role, not just the article in front of it. This group is called weak nouns (schwache Nomen), governed by what's known as the n-Declension (n-Deklination).
Why does this rule exist at all? In German, the article (der, den, dem, des) normally carries the information about case, while the noun itself stays fixed, as in der Mann, den Mann, dem Mann. But an old group of nouns, mostly referring to people, kept an older pattern that adds an ending to the noun itself to mark its role, so the noun carries the case signal on its own instead of relying purely on the article.
The mechanism is simple once you treat it as one rule: in the Nominativ (subject), the noun stays unchanged. In the other three cases — Akkusativ (direct object), Dativ (indirect object), and Genitiv (possession) — you must add the ending -(e)n to the noun itself, on top of the article changing. Which nouns follow this? Mainly people, professions, and nationalities like der Student and der Kollege; nouns ending in -e like der Junge and der Kunde; and nouns borrowed from other languages ending in -ist, -ent, -ant, or -at, like der Journalist, der Praktikant, and der Soldat. Der Herr is a special case, taking -n in the singular and -en in the plural.
One point deserves extra attention: in the Genitiv, regular nouns take -s, as in des Mannes, but weak nouns take -en, never -s — so it's des Studenten, not des Students, a difference that trips up many learners who apply the regular Genitiv rule automatically to every noun.
The most common mistake is changing only the article and leaving the noun itself unmarked, since a change like this usually only ever touches connecting words, not the shape of the noun. A learner might say Ich kenne den Student instead of den Studenten, assuming the article den alone is enough to signal meaning. The rule to remember: whenever you see a noun from this group that is not the subject, add -(e)n immediately, without hesitation.