your staying in Germany as a husband of a EU-citizen is regulated by the German law which is called Freizügigkeitsgesetz-EU. After §3.5 Nr. 2 or 4, you can keep your residence permit in case of separation and divorce, if you agree with your wife that you as a father will keep your right of a child custody in future (Number 2) or at least that you will have right of contact to the child. Additionally there is a condition that you work and pay your living costs.
Through a marriage it is possible to stay if you were married for 3 years, min. 1 year of them in Germany, before officiale applying for divorce. So it is not your variant, but it mustn't be a problem.
Except of this, on the basis of Aufenthaltsgesetz (Residence Act) you have right to stay in Germany as a father of a German child (§220.127.116.11). But I think that in your case the fist option can play a greater role.
Anyway I don't think that you are in danger to be obliged to leave Germany as long as you care for your child and the child lives here.
But I strongly recommend you to consult a good councelling center for migrants. Take a lawyer if the Ausländerbehörde makes you problems.