Both are correct, but they are used differently.
If you are asking about the translation of the sentence 'hace 2 años iba a tener un hijo' in your previous post, the correct translation is 'Two years ago, I was going to have a child.' This is the answer I suggested, and it is also that same translation that another native English speaker (Stephen from Canada) gave you.
'I would have a child' is a correct construction, but it has a different meaning.
'I would have' is part of a conditional sentence referring to present or future time. For example, you might say 'If I met the right partner, I would have a child'. However, 'I would have a child' does NOT translate the sentence about what failed to happen two years ago. 'I would have a child' describes a hypothetical situation in the present or future, not an unfulfilled intention in the past. To describe something that was to have happened in the past but did not in fact happen, you need to use 'I was going to ..'.
I hope that helps.