It’s not in the Book of Mormon. As far as I know, it’s not in the Doctrine and Covenants, and it is only hinted at in the Pearl of Great Price.
The doctrine came from a famous sermon by Joseph Smith, which includes “God himself was once as we are now, and is an exalted man, and sits enthroned in yonder heavens!” and “You have got to learn to become Gods yourselves, the same as all Gods before you have done.” It was further preached and elaborated by LDS “Prophets, Seers, and Revelators” for a while, although there have been times when the LDS church has tried to pretend the doctrine wasn’t ever taught.
When I was LDS, I certainly believed that God was literally our father, and thus it was only natural that we would become like him. I was taught to interpret various verses in the Bible and other LDS scripture so as to support this viewpoint. But when questioned about it in Time Magazine and elsewhere, the late President Gordon B Hinkley repeatedly denied knowing whether it was true or whether it was being taught.
Funny that a “Prophet, Seer, and Revelator” can pretend to be unaware of what is being taught in his church, and can claim ignorance about whether his predecessors properly understood the nature of God.