Every word has a function in a sentence. Sometimes, we can take words away and the sentence still makes sense. However, at other times, some words are essential for the sentence to not sound 'odd.' Say the sentence "I gave the book" - we would think it weird and not making much sense, "gave the book to who?"
As long as we accept that words perform a function within a sentence, then we can group these words under different headings according to their function; it helps us to think about how the grammatical structure of the sentence works. Now if we ignore all other categories apart from nouns, we can subdivide them into roughly four different sub-groups in German. Let's use the sentence above: "I gave Tom's book to my sister." The nouns here are: "I," "sister," "book," and "Tom." Now, here is where it gets a bit tricky.
1) "I" am the person doing the verb, because I was the one who gave the book to my sister.
2) "The book" is affected by the verb, because it is the thing that was given to my sister.
3) "My sister" is also implicated, in a way, by the verb, because she is the one who receives the book, or the one who was given the book.
4) "Tom" is involved, too, though probably not directly. His role is only to tell us more information about the book. It belongs to Tom, it is his possession. (If we substituted "Tom's" with "the," the sentence would still make sense.)
How does this link to cases?
1) So, when something or someone carries out the action (verb), we call that thing the SUBJECT. The subject is in the NOMINATIVE case. (This is just a jargon).
2) When something is affected directly by the verb, as in the action is done upon it, then we call it the DIRECT OBJECT. The direct object is in the ACCUSATIVE case.
3) When a verb, like "give" requires another object, one that is affected by the action but the action is not performed on it, then this is the INDIRECT OBJECT. The indirect object is in the DATIVE CASE. (Think back to the first example and how it made no sense because we would be left wondering to whom the book was given)
4) GENITIVE is the last one. It shows a possessive relationship between two things, so in our example, this would be "Tom's book" (or the book of Tom). Usually, if you see the word "of" you can be pretty sure it takes the genitive. There are anomalies to this of course!
Cases are very important in most languages, and especially in German because words change forms depending on the function it plays in the sentence. If words change, this can mean that the order of words need not be so rigid for the sentence to retain its meaning. In poetry, for instance, this can generate interesting play on words that other languages cannot because they rely a lot more on word order.
This is only an introduction, and there are a lot more to cover when it comes to cases. But I hoped this has helped at least a little bit and offers a foundation for later.