The earliest recorded use of the word 'whodunit' to mean a murder/mystery story was in an American publication called News of Books produced in 1930. It is just a joke, using the form of 'Who did it?' that an illiterate person might use and running the words into one.