Actually, the answer is a bit confusing.
The name was apparently originally a 'normal' one before one of Nikolai's ancestors added the 'Gogol' bit.
A Reference Guide to Russian Literature tells us:
Nikolai Vasil'evich Gogol' was born in 1809 in the Ukrainian town of Sorochintsii into a family of minor land-owning gentry. His real surname was, in fact, Ianovskii, but in an attempt to claim more noble Cossack ancestry, the writer's grandfather had tacked on the name Gogol' (which means "golden eye duck"). Gogol' himself had a long and "beaky" nose, and it is as though the future comic writer was born under the sign of a joke. Bogus social status proclaimed through the bathos of a comic bird (Gogol' himself would later drop the Ianovskii element of his own name) noses, overweening pretensions, comic names, the motif of birds, the Ukraine - all these would figure prominently in his later writing.
Yet a biography of the writer gives some other details, and those details seem to be slightly contradictory:
When a private tutor in St Petersburg pupils addressed Gogol as 'Mr Yanovsky', he retorted: 'Why do you call me Mr Yanovsky? My surname is Gogol. Yanovsky is only an appendage stuck on by the Poles."
In a letter to his mother in February 1832 he wrote:
I beg you to address letters to me simply as Gogol, because I don't know what has happened to the ending of my name. Perhaps someone has picked it up on the highway and is carrying it about as his own property. However that may be, I am not known anywhere here by the name of Yanovsky, and the postmen always find it difficult to find me under this sign.
Besides reinforcing the claim to Cossack nobility, there were probably other reasons for discarding the Polish-sounding Yanovsky in the aftermath of the Polish uprising of 1831. Nevertheless, the writer was left with a single surname to which he had a dubious right and which, like many Ukrainian names, sounded comic to Russian ears, in as much as it had meaning - the name of a species of duck ('golden-eye").
In 'The Old World Landowners' the narrator speaks disparagingly of those Ukrainians of humble origin, who come to St Petersburg to make a career and even change their names (converting the typical Ukrainian ending in '-o' to the Russian -ov'). Nevertheless, there is an element of self-mockery in Gogol's attitude to his own name, which may be detected in his works.