Many people assume that “What the dickens?” is a reference to the author Charles Dickens.
Considering that Shakespeare wrote this expression in ‘The Merry Wives of Windsor’ in 1600 and Charles Dickens was born in 1812, that is entirely impossible.
Instead, ‘dickens’ is a euphemism for ‘devil’, as is ‘deuce’. When Mrs Page says “I cannot tell what the dickens his name is…” she really means ‘what the devil”.
It’s a more polite way of expressing strength of an idea or emphasising their intent, in this case, that she has no idea of the identity of the person she is being asked about. It’s exactly the same as people saying ‘heck’ instead of hell, ‘gosh’ instead of ‘God’ and ‘jeez’ instead of ‘Jesus’, and is probably done for the same reason: superstitious avoidance of using religious terms, or “using in vain” the names of religious entities.
There’s also a chance that, for some folks, old-fashioned good manners may enter into it, too.
In short, this is a euphemism: an inoffensive word or phrase used to replace an impolite or offensive one. We use euphemism when we talk about “powdering my nose” or “going to see a man about a dog” instead of “going to the bathroom”, or “bathroom” instead of “toilet”.
Like many of Shakespeare’s words and phrases, “what the dickens” has stood the test of time and is still used as a euphemism today.