Breakdown of Er geht in ein Café, um einen Kaffee zu trinken.
der Kaffee
the coffee
So you see that our coffee is masculine. There are very few, close to no rules about which is what gender, just try to learn them with memos like German coffee is for tough guys
er
he
gehen
to go
in
in
ein
a, an
um zu
in order to
+ infinitive
das Café
the coffee shop
trinken
to drink
Elon.io is an online learning platform
We have an entire course teaching German grammar and vocabulary.