Gratuitous German/Analysis

Japanese Perspective
English isn't the only language the Japanese think is cool. Quite a few anime series include German words and phrases instead of, or in addition to, English words to add an exotic flair. Like English, the quality of German in an anime series can be quite good or very bad. In many cases, the German sounds angry to most English listeners (and plain annoying/stupid to others), regardless of what is being said; this is rather different from how it is spoken in Germany, where it is more nuanced and even quite pleasant to listen to. Ja! That movie of Hitler getting angry and speaking in German might have something to do with it. The fact that he's speaking with an Austrian accent never dawned upon us, and neither did the fact that Hitler's speaking style is quite unique and hard to comprehend for the average German OR Austrian to begin with.

A variation on this trope is that when an anime character is mixed Japanese and something else, the "something else" often turns out to be German. This may result in the character speaking some garbled German at some point.

The popularity of German is possibly related to good relations between Japan and Germany during the 20th century. Or because when Japan was modernizing in the late 19th century, it borrowed heavily from Germany, which was also a newly forming nation-state at the time, and world class in technology and science (e.g., the Japanese legislature is called the Diet in some countries as it was partially patterned on the 19th-century Prussian Diet. In Japanese, it is apparently called the "Kokkai", literal translation is National Assembly which makes a lot more sense.).

Western Perspective
In Western media, Gratuitous German is often associated with Those Wacky Nazis, but also crops up in philosophy and psychoanalysis - any substitute for Sigmund Freud will litter his flavour of Poirot Speak with it. In other words, Everything Sounds Smarter in German, so don't be surprised if he starts talking about how the Kantian Ding an sich ist inherently incompatible with the Weltanschauung of the Ubermensch because for him, Gott ist tot, and the Wille zur Macht ist such that.....

Although both are West Germanic languages and thus closely related, the German Language has kept a bit more of the original comparatively high amount of grammatical inflection than English. This often makes it difficult for foreign language speakers, resulting in frequent and very visible grammatical errors even if the sentence is understandable in general. Never expect the grammar to be proper; expect a Blind Idiot Translation.