When people began to multiply on the face of the ground, and daughters were born to them, the sons of God saw that they were fair; and they took wives for themselves of all that they chose.
Genesis 6 opens with one of the most unusual little episodes in the bible. Despite these three sentences failing to mention them, Augustine claimed the 'sons of God' were the descendants of Seth, and the 'daughters of men' were descendants of Cain, resulting in Seth's righteous descendants being corrupted by Cain's. Another semi-common view defended in recent decades is that the 'sons of God' were men of royalty and nobility, taking 'daughters of men' from the common people. This at least has some support from other biblical literature; Psalm 2 identifies the king of Israel as God's 'son', and the Book of Esther shows the Persian king stealing women from across his kingdom to fill his harem.
However, the interpretation of the text that readers feel an aversion to really seems to be the correct one: a crowd of angels, called 'Watchers', married human women.
Christians balk at the idea that angels could marry women because of a saying from Jesus (Mark 12.25). Some rabbinic authorities in ancient Judaism also rejected the notion. However, this was the majority reading in Second Temple Judaism and in early Christianity, and although the text itself doesn't say so directly, this action of the Watchers was seen as a very bad thing.
"And [the Watchers] have gone to the daughters of the men of earth, and they have mated with them, and have defiled themselves with the women"
1 Enoch 9.8
And [Enoch] testified to the Watchers, who had sinned with the daughters of men; for these had begun to unite themselves, so as to be defiled, with the daughters of men
"And when the angels of God saw the daughters of men that they were beautiful, they took unto themselves wives of all of them whom they chose." Those beings, whom other philosophers call demons, Moses usually calls angels; and they are souls hovering in the air.
Philo, On the Giants 2
For many angels of God coupled with women, and begat sons that proved unjust
Josephus, Jewish Antiquities 1.3.1
And the angels who did not keep their own position, but left their proper dwelling, […] indulged in sexual immorality and pursued unnatural lust
First Enoch 1-36 is the earliest account of this story outside Genesis, dating to about 300 BC. The author of this work greatly expands on Genesis 6.1-4, showing the Watchers as fully aware their actions were 'a great sin'. They proceed to teach humanity forbidden knowledge as well, including the crafting of weapons and the practice of war. This, the author shows, is the reason for the universal violence that necessitates God sending a flood to wipe out humanity.
In addition to this interpretive history of Genesis 6.1-4, we can also see how the phrase 'sons of God' is referring to angels, not noble or righteous humans. Firstly, of course, is that these sons of God are contrasted with 'daughters of men'. The 'of men' would be wholly unnecessary if they were all humans; the use of 'of men' is meant to distinguish the nature of the two categories.
Further, we have plenty of examples where 'sons of God' is used in the Hebrew bible to designate angelic beings. Deuteronomy 32.8 says the number of nations is 'according to the number of the gods', and 32.43 commands 'the gods' to worship God. In both cases, the Septuagint (c 250 BC) reads 'sons of God'. Over in the Book of Daniel, we find various angels referred to as 'a son of the gods' (3.25), 'a holy watcher' (4.13,23), and some are 'princes' that preside over the nations (10.13,20; 12.1). In a handful of texts we find glimpses of the 'divine council', the royal court of heaven where God is surrounded by the heavenly host: 1 Kings 22.19-22 calls them 'spirits', Job 1-2 calls them 'sons of God', Job 38.7 calls them 'the morning stars', Psalm 29.1 calls them 'sons of God', Psalm 82 says 'gods' and 'sons of the Most High', and Psalm 89.6-7 has 'sons of God' and 'assembly of the holy ones'.
The Hebrew idiom 'sons of God' (bene elohim and variants) is
an archaism, derived from the older Canaanite phrase "Sons/Children of El" (bn ʾil)
Hendel, 'The Nephilim Were on the Earth',
The Fall of the Angels, 18
Here, 'El' is the name of a Canaanite god. (The word is a cognate to the biblical word that simply means 'god' or 'deity'). Various passages of Canaanite literature show the sons of El to be immortal, members of the divine council in heaven, but inferior to their father El (ibid., 24). There is no immediate parallel in Canaanite literature to the story of Genesis 6.1-4, and Israelite biblical literature never suggests God literally fathered the angels as his children, but it does appear that the Israelites borrowed the specific phrase 'sons of El' and converted it into an epithet for the divine council of angels created by God.
The phrase in Genesis 6.1-4, the 'sons of God', was a common epithet for the heavenly creatures God had made, normally called 'angels' and sometimes called 'gods'. Second Temple-era Judeans called them 'Watchers'. This story is, in essence a myth of gods abandoning their homes in heaven to produce offspring by human women.