The word "Dativ" comes from latin "dare", meaning "to give". In German, it's the third grammar case. This case is used when someone directly gives, says or declares something to someone. For example: I give my friend a gift (I give a gift "to my friend"), which translates to "Ich gebe meinem (dativ) Freund ein Geschenk". The -em part in "mein" indicates the 3rd case (remember: mein, meines, meinem, meinen for masculine words).
The word "Akkusativ" derives from greek "aitiatike" meaning reason or cause. In German, it's the fourth grammar case. This is an indirect case. Example: I see my friend which becomes "Ich sehe meinen Freund". The article in front of Freund becomes meinEN, which indicates the fourth case. It is not a direct action against someone anymore, therefore Akkusativ.
Then of course there is a list of prepositions that is either followed by dativ or akkusativ.
Dativ: ab, ausser, zu, nach, bei, von, aus, mit, seit, gegenüber Akkusativ: bis, durch, für, ohne, gegen, umAnd prepositions that can get either akkusativ or dativ depending on the action:in, an, auf, neben, hinter, über, unter, vor, zwischen. With these prepositions you ask yourself wether it describes a movement or a location.
For example, the preposition in:Er steigt ins Bus ein (he boards the bus - movement so becomes akkusativ "in das Bus")Er sitzt im Bus (he's sitting on the bus - location, where is he sitting? Becomes dativ "in dem Bus")