It's really easy, actually... "Der" is for masculine words, "die" for feminine words, and "das" for neutral words - all singular. For plural it's always "die". Thing is, you basically just have to learn whether a word is masculine, feminine, or neutral, because not all things that don't have an actual gender are neutral in German. For example, "der Tisch" (the table) is masculine even though it is a thing and "die Lampe" (the lamp) is feminine... But even animals can be a certain grammatical gender if it's not specified what actual gender they are. For example it's always "die Spinne" (the spider) unless it's actually important what gender it is. Same goes for "das Schaf" (the sheep). Sometimes there is one word for each, like "der Hund" (the dog in general, but also specifically a male dog) and "die Hündin" (when it's specifically a female dog).
Long story short, it's something you just learn with the word itself and have to remember.