In the Book of Genesis, the serpent represents or is embodied by Satan, the arch enemy of God. God has placed the Tree of the Knowledge of Good and Evil in the middle of the Garden of Eden, and has commanded Adam and Eve not to eat of it. The Tree of Life is also there, but God does not seem to have placed any restrictions on it.
The serpent tempts Eve to eat from the Tree of the Knowledge of Good and Evil and thus become like God, knowing good and evil. Though Eve knows the restrictions, she takes and eats, believing the serpent that, in some way, God is holding out on mankind, by denying them knowledge. Eve, and subsequently Adam, through eating of the Tree of the Knowledge of Good and Evil are also subject to the consequences of good and evil, namely physical death.
In the Epic of Gilgamesh, the serpent is not personified. A plant granting immortality is given to Gilgamesh by Utnapishtim as a gift. While Gilgamesh sleeps (a semblance of death), the snake steals the plant, eats it, and thus rejuvenates, shedding its skin. By this, mankind is denied immortality.
The difference between the two accounts is in the moral derived from this episode with the serpent. In the Biblical account, this is an explanation of the entrance to sin (disobedience of God’s commandments), whereas the Epic of Gilgamesh is more of a nature myth, without any mention of sin. Man is condemned to die, not through disobedience but through the loss of the plant.