If you work more than what is agreed contractually, these extra hours are known as overtime or "Überstunde".
Whether you have to work overtime depends on your employment contract or collective agreement. So if there is a regulation about overtime in your contract or "Tarifvertrag", you must abide. Otherwise, you can often reject overtime working if you choose so. Only in exceptional cases, i.e. in the event of disasters and emergencies (e.g. a flood in the company) or concerning special operational assignments (e.g. when a task is essential for the survival of the company and has to be completed in at short notice), all employees must work overtime regardless of your employment contract or collective agreement.
Whether the overtime is compensated by additional money or additional free time is often regulated in the employment contract. If your contract specifies that overtime work is not compensated (either by money or free time), the overtime work you do may not amount to more than 10% of your contractually agreed working hours. If your contract does not include any regulation regarding overtime, in principle, you will receive extra wages for the overtime work according to your hourly wages- the prerequisite, however, is that overtime work is ordered by your superiors and you have documented your overtime(s) in writing- i.e. you need to write down your overtime(s) and have it signed by your boss.
Please note: Employees who receive large salaries (i.e. above 5800 euro gross in East Germany and over 6500 euro gross in West Germany per month) do not receive extra pay for working overtime.