It's not just German. Pretty much every "foreign" language suffers the same fate in Hollywood movies.
(Exception: Spanish, because a large minority of Americans actually understand a little bit of Spanish. Indeed some are even native Spanish speakers.)
Consider for example Captain Fantastic (2016) which had pretensions of being an intelligent film and where everyone in the family depicted was super-intelligent and capable:
- The 8-year-old knew all about the Bill of Rights and some 2010 Supreme Court Case. And could articulate an intelligent opinion about it.
- Father was going to test son on quantum entanglement and Planck length vs Planck time.
- They all played/sang amazingly beautiful music.
- And they weren't just bookish nerds. They live outdoors, hunt their own food, do military-style exercises everyday, and can fly over rooftops ninja-style (providing there's no falling tile).
But unfortunately, there was this scene where they started speaking in a variety of "foreign" languages. The purpose of this scene was to impress the viewer with yet another one of this remarkable family's amazing talents.
But unfortunately the "foreign" languages were spoken horribly and it was obvious they had just been lines memorized from a script. So if you actually understand any of these "foreign" languages, this is one part of the movie that kinda falls apart and undermines the whole "super-intelligent hippie family" premise of the movie.
The Mandarin was particularly and comically awful. (On my first viewing, I could vaguely tell that Mandarin was probably being spoken. It was only when I was writing this answer and watched this clip several more times that I could make out what exactly the guy was saying.)
(And would a German speaker please also let me know if "Ich können Deutsch sprechen" is even grammatically correct? @TaW: "No it isn't. Correct: Ich kann Deutsch (sprechen)".)
But the thing is, most Americans (including the writers and director) understand only English and wouldn't know anyway. The writers don't care, the director doesn't care, the actors don't care, the viewers don't care. So why bother wasting even a bit of money or time on something that no one cares about?
(Some have argued in the comments below that in Captain Fantastic, "foreign" languages happened to be the family's one and only blemish among their multitude of amazing talents. But I favor a simpler explanation: the director, writers, and actors simply didn't bother getting this right or didn't know how to.)
I think though that nowadays for blockbuster Hollywood movies directed at a global audience, they do make more of an effort. (These days, for blockbuster movies, the US box office revenue is usually less than the outside-US revenue.) So for example Arrival which featured a somewhat prominent role for Chinese characters actually bothered making an effort. Indeed they even spent some good money inventing the alien language. (Though in the brief scene where Amy Adams was speaking Mandarin, it wasn't very good, which was inconsistent with her being a polyglot linguist who could speak Mandarin.)
But Captain Fantastic and older movies like Die Hard were definitely targeted only at an American audience.
Note: My answer doesn't explain the Heidi Klum bit in HIMYM which I've never seen.