Naturally, German is the primary language spoken in Germany. There are also lots of dialects, but they are only spoken in particular regions. A Bavarian will not understand the northern German "Platt" dialect, just as someone from the North won't be able to master Bavarian.
If you live in Germany, you should learn German. People appreciate it when you try to communicate in the native language. If you don't know the right words, then try English, as nearly all Germans have learned it at school.
English is the most common foreign language spoken among Germans, followed by French and Spanish. But Germany is a country of immigration, and immigrants obviously bring with them their native languages as well as their cultures. So in the cities, you will hear lots of other languages, especially Turkish and Italian.