I've the same information as @Thor: only a vocational training (Ausbildung) allow you to stay in Germany (it's called "Ausbildungsduldung") but not studing. But there is a special form of study: it's called "Duales Studium". It's usually a work contract with a company while you are also a student and work in part time.
In this case you have to ask the work permission to the Ausländerbehörder and there is no garantie, you are going to get a permission. But some Duales Studium programms have got an "Ausbildung"/vocational training by the plan: so if you are able to get a Duales Studium contract with Ausbildung (vocational training) by an university of applied science (this are usually programms offered by Fachhochschule/Uni of applied science, called "Ausbildungsintegrierte Studium"), you can then ask für the residence permission for the duration of the vocational training.
I will suggest you, to contact a consultation on study and vocational training in your city. If you are in Berlin, you can contact the LernLaden Neukölln or any other center for consultation on profession and studies (so called: "Beratung für Bildung und Beruf") (https://www.berlin.de/sen/arbeit/berlinarbeit-ziel-3/weiterbildung/berliner-weg/) I hope I could be helpfully :)
I wish you all the best!