There is somewhat of a system to it, but there are too many exceptions to even remotely rely on it. You need to learn the article with the word, so always learn "moon = der Mond", not just "moon = Mond". I did that wrong when I learned French, and it still haunts me.