If you plan to study in Germany, you have to submit an application for a student visa to the respective German mission abroad. Documents have to be presented proving inter alia that the applicant has been accepted for studies by the university. The German mission abroad will then forward the visa application for an opinion to the foreigners authority in the town housing the university.
The German mission abroad can only issue the visa for entry once the foreigners authority has given its approval.
Details on the documents to be presented with your visa application are often available on the webpage of the competent German mission abroad or directly from the mission itself.
German missions abroad: Countries A to Z