S.H.
it is probably because, before pooping... (like even for adults), there is sometimes bowel pain... which for adults, indicates that we then have to poop soon. For an infant... they don't know that... all they know, is that there is discomfort. Then their poop does come out. They don't know the bodily cues for it yet. All they know, is discomfort. Thus they cry.
My son as a baby, whenever he was going to poop, made a TON of noise and his face would turn all red. THEN a poop came out.
Your baby's poop consistency/color, is normal for a newborn.
For gas, you can try Mylicon infant gas drops. It works well.
And burp him during/after any feedings.
all the best,
Susan