There is a small number of general legal requirements you will need to fulfil before you can set up your own business in Germany. You need to be an adult, so at least 18 years of age. Another requirement is that you have never been banned from practicing the profession you intend to set up a business in. Such prohibitions can be imposed by courts after serious offences.
Before you start your own business, you need to register your planned activity. You do that either with the trade office (Gewerbeamt) or the tax office (Finanzamt), depending on whether you intend to work on a self-employed basis (gewerblich) or as a freelancer (freiberuflich). For some professions, you will need to prove that you do not have a criminal record. EU citizens resident in Germany can usually apply for a “European certificate of good conduct” at your local registration office. If you are from a different country, you will need to obtain a comparable document from the competent authority in your country.
Additional information on the formalities you need to go through as you set up your business is available here.