Dear @daran,
It´s also possible for you as father of a minor German to get a residence permit for the purpose of care and custody granted even though you don´t live together with your child and his mother. In this case, you have to prove that you maintain an intensive contact with your child (for example with a confirmation of the Youth Welfare Office). If you don´t maintain such an intensive contact to your child (occasional visits, contacts through letters and phone calls or maintenance payments), the immigration authority won´t grant the residence permit.
If you get the residence permit issued from the Immigration authority, you can apply for the permanent residence permit after three years if you have German language skills of the Level B1 and you have enough income to secure your own subsistence.
Best regards
WKZB1