The German representative authorties in your home country (German consulate, embassy) will inform you about the conditions for a visa for study purposes.
Important: Under no circumstances should you enter Germany on a tourist visa, as this cannot be subsequently converted into a student visa!
To obtain a visa for study purposes, you must have been admitted to a university or college. If you do not yet have admission to a course of study, you can also first apply for a study applicant visa, which is valid for three months. Like the visa for study purposes, this will then be converted into a residence permit for study purposes by the competent foreigners authority within three months of entry if you take up a course of study.
If a language course is to be taken in preparation for studies, this must be stated when applying for a visa. For this purpose of stay, a language visa or a study applicant visa must be applied for.
See also Visa,Residence