In a period of a week of finding permanent accommodation (i.e. not a hotel), you have to register your address at the local Residence Registration Office (Einwohnermeldeamt), generally located in the town or city hall.
All consecutive change of address must also be registered with the relevant local authority. This rule applies to everyone, including German nationals.
You need to present your passport and visa (if you have one), a copy of the lease or rental agreement and a completed registration form, which is usually available at the Einwohnermeldeamt to register. Offices and agencies have changeable opening times, particularly in the afternoons, so check before you go.
If everything is in order, you will be given a confirmation form (Anmeldebestätigung) as proof of your registration. You will need it a lot during your first weeks in Germany therefore make a copy (or several) of the Anmeldebestätigung. A lot of institutions like banks, libraries etc. will ask for it as this serves as a proof of your address.
You will also receive an income-tax card if you’re eligible for one at the Einwohnermeldeamt,. Give this to your employer, who will use it in deducting income and social security taxes.
To apply for a residency permit, you need your residence registration first. Once you have the Anmeldebestätigung, proceed to the immigration office to get your residency permit.