Eve was to have pains at childbirth because she ate of the tree of the knowledge of good and evil. This story is found in the book of Genesis in the Bible, and it describes how God created Adam and Eve and placed them in the Garden of Eden. He instructed them not to eat from the tree of the knowledge of good and evil, warning them that if they did, they would surely die.
However, Eve was tempted by the serpent and ate from the tree. She then convinced Adam to eat from the tree as well. As a result of their disobedience, sin entered the world, and they were expelled from the Garden of Eden.
One of the consequences of their disobedience was that Eve would have pain during childbirth. This is described in Genesis 3:16, where God tells Eve, "I will make your pains in childbearing very severe; with painful labor you will give birth to children."
Therefore, the reason why Eve was to have pains at childbirth was that she disobeyed God by eating from the tree of the knowledge of good and evil. This consequence was part of the punishment for their disobedience and serves as a reminder of the devastating consequences of sin.