A freelancer (Freiberufler) is a self-employed professional with special qualifications who sells their services. Self-employed doctors, lawyers, accountants, engineers, IT professionals and architects are usually Freiberufler.
Not all self-employed people are Freiberufler. If you are self-employed, but not a Freiberufler, the tax office calls you a Gewerbetreibender, and the immigration office calls you Selbständig.
The difference is important: it affects the taxes you pay and the type of residence permit you get.