Thank you for sharing your situation with the Wefugee Community! If I understood your case correctly, you should be able to apply for a residence permit according to §28 AufenthG, as you are the father of a German child. In order to apply for the residence permit, you do not need to be married to the child's mother. Instead, living in a "familäre Lebensgemeinschaft" (§28 Abs. 1 Satz 4) with your child will be the foundation of the application (i.e. seeing your child regularly, paying aliment etc.). However, and as @TRYSZKA mentioned, I can recommend you to talk to a counsellor or a lawyer about your case. If there are any further questions, you are also always welcome to get back to us. I hope this helps.
All the best,