Dear Jude Benson,
if you want to share the "Sorgerecht" for your child, you can apply for it at the youth welfare office (Jugendamt). They will support you in finding a solution and mediate between you and the child's mother. If this will turn out to be unsuccessful, there might also be an option to go to the court about this. Still, not having the Sorgerecht (custody) is not necessarily disqualifying you from the residence permit according to §28 AufenthG. Instead, you will definitely have to proof your regular contact and your relationship with the child.
I hope this helps and feel free to get back to us if any clarification is needed.
All the best,