🔼The name Onan in the Bible
Judah married Er to Tamar, but Er was "evil in the sight of YHWH," and so he died. But evil or not, Er needed offspring and Judah evoked the custom that later would become the levirate law (Deuteronomy 25:5-6; levirate has nothing to do with Levite; it comes from the Latin word levir, meaning brother-in-law). It stipulates that when a man dies childless, his brother is required to impregnate his widow. The thus first-born son would carry on the name of the deceased man.
Onan appears to have had no problem with decking Tamar, but at the moment supreme he "wasted his seed on the ground". That displeased the Lord as well and Onan consequently followed his brother into the grave (Genesis 38:10).
Judah promised Tamar to his third son Shelah, but forgot all about it. When she realized she'd been duped, she tricked Judah into impregnating her. The result were the twins Perez and Zerah (Genesis 38:29-30).
🔼Etymology of the name Onan
The name Onan comes from the root group און ('wn), meaning either sorrow or vigor:
For a meaning of the name Onan, Jones' Dictionary of Old Testament Proper Names derives it from the root און I and reads Iniquity. NOBSE Study Bible Name List takes our name from און II and proposes Strong. BDB Theological Dictionary too lists our name under און II and reads Vigorous.