Breakdown of Ich habe den Kaffee bestellt.
ich
I
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
haben
to have
bestellen
to order food etc.
Elon.io is an online learning platform
We have an entire course teaching German grammar and vocabulary.