Dear @Pan 123,
Thank you for sharing your question with the Wefugees Community!
Similar situations were discussed on this platform already before. Please check, for example, the following threads:
Applying for residency through my 2 Childen or I don't have custody for my child - Can I apply for a residence permit?
As @Deprince mentioned, it could be useful for a better understanding if you share some more details of the case.
However, in order to have a chance to be granted a so-called "Aufenthaltserlaubnis zur Personensorge" (this would be a residence permit to be able to take care of your child/children) it will be important that you will do the acknowledgement of paternity ("Vaterschaftsanerkennung") and you will need to prove that you actually take care of the child. Related to this, declaring officially the custody for your child might also be helpful.
Please feel free to get back to us with any further questions.
All the best,
Meike