Why are there so many genealogies in the Bible?
In an essay about the Servant of the Lord, Stephen Dempster sheds some light on this issue. The creation accounts in Gen 1-2 stress the proper function of human beings in the world God created. They are to serve and keep the Garden; they are to "worship and obey" the Lord.
The Fall in Gen 3, however, frustrates this service. Adam no longer "keeps" the Garden, and his first born son is no longer his brother's "keeper" (Gen 4:9).
Yet, in the midst of the curses for disobedience God promises a human seed that will crush the head of the serpent and will "exercise proper dominion over the creation again." Dempster notes that
This focus on descendants explains the extraordinary emphasis on genealogy in Genesis. It is not just a backward-looking device that traces the roots of a people; it functions to create anticipation for a future descendant.—Stephen G. Dempster, "The Servant of the Lord," in Central Themes in Biblical Theology, 137.
This is why Eve is so happy when she gives birth to Seth after the death of Abel (Gen 4:25), and why Seth's genealogy (Gen 5:1-32), in contrast to Cain's, focuses on life, concluding with the birth of a son, Noah, who is regarded as a signal of hope for the future (Gen 5:29).