When Hanuman took a dip in the waters of sea, after burning whole of
Lanka with the fire burning on his tail, a drop of his perspiration
fell in to mouth of a mighty fish. Out of this the Makardhwaja was
According to another, slightly different version, when Hanuman took a
dip in sea, for cooling himself after burning Lanka; a drop of his
seed got discharged, due to extreme heat generated in his body and
labor by him, which fell in to mouth of a giant fish-cum-reptile like
creature, whose name was Makardhwaja, thus making it pregnant.
The fish was caught by people of Ahiravana, who ruled Patala, the
nether-world. The Markardhwaja, was discovered, when stomach of fish
was cut open and named after it. Ahiravana, seeing his strength &
virility gave him job of guarding, the gates of his Kingdom.
So Lord Hanuman had a child without his own knowledge and that doesn't make him non-bachelor.
On a side note, refer this answer for the details lord Hanumans his wife.