In addition to (or variation of) Jonathan's perfect answer, just because sometimes looking at something from different angles may help getting familiar with it:
You seem to come from a language without "cases", therefore the concept is alien to you. Don't be afraid, it is neither difficult, nor is it restricted to German. All indo-european languages have it. (English also has it, but in English it has lost most of its visibility on the surface, and you find only faint traces of it like the distinction between who and whom and of course the genitive form with "s" as in Jonathan's perfect answer). Other language families such as the Turkic languages do have it as well. Or if you want to see case forms in abundance, study the Finno-Ugric languages (e.g. Hungarian).
Cases can be seen as a way how nouns (etc.) relate to other parts of a sentence, e.g. to verbs, or to other nouns.
Ich esse [wen? Akkusativ:] eine Pizza [wo? Dativ:] im Restaurant.
Die Pizza [wessen? Genitiv:] meines Bruders ist besser.
Der Kellner bringt [wen? Akkusativ] die Pizza auf [wo? Dativ:] dem Teller zum [wohin? Dativ:] Nachbartisch.
(If you wonder about dative being used here for wo and wohin: note that there is not necessarily a consequent logic behind associations of cases and meanings. Much of it has become just convention, or in other words: it is as it is and you simply have to accept it.)
In "pure" form, a noun (and corresponding adjective) would have a certain form (usually a certain suffix) to indicate its case.
But unfortunately in many languages the distinct forms (one for each case) got blurred a bit, and suffixes got lost (as you see also in the examples above where not each case has its distinct form any more). This went to the extreme in English. Whereas in Russian for example you have distinct forms preserved for almost any position. Here is an example for a complete set of word forms for ev (house) in Turkish:
ev [house, nominative]
eve [to the house, dative]
evden [from the house, ablative]
evde [at the house, locative]
evi [the house, accusative]
evin [of the house, genitive]
Now, for the functionality of cases in human languages: an easy way to understand it is that they are one of several possible means to signal certain relations: Where ev in Turkish is the house, eve is to the house; where şehir is town, şehire is to the town. As you can see from the examples, Turkish uses here only suffixes (and nothing else) to indicate these relations whereas English obviously does not use case-endings (suffixes) at all any more and relies completely on little "relational" words called prepositions (to, at, in, from...).
This is not necessarily a "one way or the other" thing in human languages. Some languages have it both: prepositions plus (!) case-endings (suffixes). For example in German you can say
zum Hause / to the house
and as well
zum Haus / to the house
which is preposition zum1 (to), plus - optionally - a case suffix for dative (-e) attached to the noun. The case suffix for dative is not obligatory; you can use it and sound a bit old-fashioned (or super elegant), or you can dismiss it and sound "normal" in today's everyday life.
1 More exactly, zum is a contraction of zu dem where zu is the preposition and dem is a definite article in dative.