Αυτός means "he", not "it", right? Or must one use "he" whenever a noun is masculine, even when it is inanimate?
Correct on both counts! Grammatical gender follows those parts of speech that have it (nouns, articles, adjectives, participles, pronouns) wherever they go!
It is my coffee = Είναι καφέ μου and Αυτός είναι ο καφές μου = That is my coffee?
Because of cases.
ο καφές is the nominative case, used e.g. for the subject of a verb.
του καφέ is the genitive case, used e.g. in the meaning of "of the coffee" or "the coffee's".
τον καφέ is the accusative case, used e.g. after many prepositions or as the object of a verb.
That's right, καφές is a masculine noun and so it takes the masculine form αυτός of "this" / "it".
The most reliable way is to look it up in a dictionary.
But you can usually guess based on the ending:
- Masculine: -ος, -ας, -ης, -ες, -ους
- Feminine: -η, -α, -ου
- Neuter: -ο, -ι, -μα
It’s not foolproof (the ending -ος in particular can be any gender) but that’s a good rule of thumb.