Gandalf and the other Wise (Elrond, Galadriel, etc.) had certainly heard of
Durin's Bane, knew it once lived in Moria and knew it was a Balrog.
However, it had been over 1000 years since anyone had seen it (and lived to
tell the tale ;)). So, perhaps they (Gandalf in particular) were hopeful
that it had moved it's residence, or was so far underground that they could get
through Moria without meeting it. Moria was a huge, huge place after all.
Also, it just occurred to me that Gandalf had been in Moria before (going East
to West, I believe) and didn't encounter the Balrog. That probably added
to his
optimism.