Hi, He grew up near the Gladden Fields, he had a good general idea of where Moria was. I believe the Front Gate was not the only entrance into Moria: I think I recall that the Orcs made other, lesser entrances, too, so he did not necessarily have to cross over the Bridge and into the Second Hall. Remember that he had to get out of Moria: the Bridge had been destroyed, none but the Company of the Ring (less Gandalf) crossed into the First Hall and exited with Aragorn, yet Gollum followed them into Lórien.
I think I also recall that Gollum entered Moria to hide from Sauron after he “escaped”. He was successful, but afraid of the Orcs, he moved further west, into less inhabited parts. He found the West Gate, but was too weak (from hunger) to open it. Tolkien says the entry of the Company of the Ring by that way saved.
please help. thanks! I didn't find the right solution from the Internet.