It’s a silly-sounding word for a a foolish or stupid person.
Many writers have tried hard to find an origin for it, though most dictionaries play safe and list it as “origin unknown”. The good Dr Johnson, in his famous Dictionary of 1755, said it was from Latin non compos, as in the medical and legal phrase non compos mentis, not mentally competent. But as the Oxford English Dictionary commented 150 years later, this supposed origin doesn’t explain versions of the word that were around in the seventeenth and early eighteenth centuries, such as nicompoop and nickumpoop. The first edition of the OED concluded that the word was simply a fanciful formation.
The late John Ciardi, in A Browser’s Dictionary, dismissively calls the OED’s idea “a clerk’s guess” and asserts that it comes instead from the Dutch phrase nicht om poep, meaning “the female relative of a fool”. He added, “And if that does not work out ... I will be a monkey’s uncle”. Such a stretched derivation from a foreign language is typical of a type of folk etymology that turns up a lot. Though there was once an English verb poop, to fool or cheat, and it did come from Dutch poep, the original Dutch word meant a shit or a fart — the English slang poop for faeces comes from this.
The association with a fool came through a slang use of the word by the Dutch in the seventeenth century for a migrant worker from northern Germany. Modern Dutch speakers use nicht specifically for a niece, not just any female relative, but it is also slang for an effeminate homosexual. So nicht om poep might be construed with quite a different meaning.
A more intriguing idea, one with a fair level of acceptance that is given with some caution in the current revision of the OED, links it with the given name Nicodemus, especially the Pharisee of that name who questioned Christ so naively in the Gospel of St John. This word still exists in French as nicodème, a simpleton.