In 1 Nephi 11:11, Nephi asks the Spirit to know the interpretation of the tree of life. In response, the Spirit shows Nephi a vision of the virgin Mary with her child Jesus (verses 12-20) and asks: Knowest thou the meaning of the tree which thy father saw? Rather oddly, Nephi answers yes, however no mention of the tree was given at all in verses 12-20.
Daniel C. Peterson explains:
Why would Nephi see a connection between a tree and the virginal mother of a divine child? His vision seems to reflect a meaning of the “sacred tree” that is unique to the ancient Near East and, in Israelite history, specifically to the period before the Babylonian captivity — Nephi’s era. This can only be fully appreciated when the ancient Canaanite and Israelite associations of that tree are borne in mind.
Recent scholarship, including archaeological finds, has demonstrated that the goddess Asherah, worshipped among Israel’s Canaanite neighbors as the wife of the supreme god, El, was also revered by many Israelites as the consort of El(ohim) and the (in some accounts, virginal) mother of his children. She was symbolized by a tree, and, in fact, a representation of such a tree stood within the temple at Jerusalem during the time of Lehi.
An early Hebrew like Nephi, however, would immediately have understood the representation, by a tree, of a virginal mother of a divine son.– Daniel Peterson: How Nephi understood the Tree of Life (and why the Book of Mormon is an ancient record)
The inclusion in 1 Nephi of an authentically pre-exilic religious symbol that could scarcely have been derived by a New York farm boy from his Bible strongly suggests that the Book of Mormon is, indeed, an ancient historical record in the Semitic tradition.– Daniel Peterson: How Nephi understood the Tree of Life (and why the Book of Mormon is an ancient record)
Where would Joseph Smith have gotten this information? How did he have the education and skills to include this symbolism?