Hello @Zichako
It's true that it's possible to get a so-called Ausbildungsduldung for the duration of an Ausbildung. It enables you to stay in Germany for ~3 years (usually) and after that you will have 6 months to find a job in a related field. If you succeed you will get a residence permit for another 2 years.
Studying at university, however, does not grant you a residence permit and it will not change your legal status.
Best regards,
Thorgen