While Joseph Smith would have been familiar with the story of Cain, he likely would not have known the meaning of the name.
Matthew L. Bowen explains the wordplay on Cain’s name in the Book of Mormon:
The biblical etiology (story of origin) for the name “Cain” associates his name with the Hebrew verb qny/qnh, “to get,” “gain,” “acquire,” “create,” or “procreate” in a positive sense. A fuller form of this etiology, known to us indirectly through the Book of Mormon text and directly through the restored text of the Joseph Smith Translation, creates additional wordplay on “Cain” that associates his name with murder to “get gain.” This fuller narrative is thus also an etiology for organized evil—secret combinations “built up to get power and gain” (Ether 8:22–23; 11:15). The original etiology exerted a tremendous influence on Book of Mormon writers (e.g., Nephi, Jacob, Alma, Mormon, and Moroni) who frequently used allusions to this narrative and sometimes replicated the wordplay on “Cain” and “getting gain.” The fuller narrative seems to have exerted its greatest influence on Mormon and Moroni, who witnessed the destruction of their nation firsthand — destruction catalyzed by Cainitic secret combinations. Moroni, in particular, invokes the Cain etiology in describing the destruction of the Jaredites by secret combinations. The destruction of two nations by Cainitic secret combinations stand as two witnesses and a warning to latter-day Gentiles (and Israel) against building up these societies and allowing them to flourish.– Matthew L. Bowen – Getting Cain and Gain
How would Joseph Smith manage to create this wordplay if he didn’t know the meaning of “Cain”?