If you do not have German citizenship and would like to live in Germany long-term, then you need a residence permit.
This does not include citizens of the European Union (EU) and the European Economic Area (EEA) with their third-country family members with a derived right to freedom of movementas well as repatriated individuals (Spätaussiedler) who automatically receive German citizenship when they are recognised as such. All other people require a residence permit in order to live and work in Germany.
There are various kinds of residence permits. The type of residence permit someone needs depends on the purpose and the duration of residency andtheir nationality.
The agency responsible for issuing residence permits is the immigration authority (Ausländerbehörde).
If you or your family members are still residing in a foreign country, a residence permit is issued as a visa for entry. The German representation abroad (embassy or consulate general) in the country of residence is responsible for carrying out the visa granting process.