To expand on:
You're challenging national identities. If someone is from Austria, they need to choose a German flag. While that may not be a big deal to you, to many Austrians it is.
Germany vs. Austria or US vs. GB are relatively harmless examples. I assume in most cases you'd get mild annoyance from the side you didn't choose. But for other countries the issue might be a bit more explosive.
For example Chinese comes in two main written forms: Simplified Chinese which is mainly used in Mainland China, and Traditional Chinese which is mainly used in Taiwan. Choosing a flag for Traditional Chinese sounds rather delicate. I certainly wouldn't use the Taiwanese flag there, since Chinese users are easily angered.
I wouldn't be surprised if there are even more problematic choices in some other countries. For example Windows 95 had a timezone highlighting feature, which was removed to avoid offending governments who disagreed over some border.
Another point is that often don't choose just a language, but also a culture. This usually amounts to a language-country pair. This affects things like date formatting (DD.MM.YYYY vs. MM/DD/YYYY etc.) units (metric vs. imperial), decimal separators,...
Some countries have multiple languages. Some languages are country dependent, for example Portuguese (Portugal) and Portuguese (Brazil) are different.
Condensing all of this down to a simple flags sounds difficult.
I'd use a simple dropdown box, and preselect the language/culture from the HTTP header (do not use geo-ip for language selection) so most users don't need to choose at all. The main problem with this solution is having the user discover the language settings in the first place. So you probably should put some icon next to the dropdown box that signifies "language" (which is a problem of its own).