The actor John Gielgud believed that of all Shakespeare's characters Hamlet is probably the one most like Shakespeare himself–since, of all Shakespeare's characters, only Hamlet can be imagined to have written all the Shakespearean plays. How good an understanding of Hamlet's character does Gielgud's belief reflect?
Answers
The main reason 19th century writers saw Hamlet in Shakespeare was that they saw Hamlet in themselves. Keats and Coleridge wanted to link themselves with Shakespeare, and if Hamlet was melancholic, well, so were they sometimes, and so was Shakespeare, probably, at some point in his life. The biggest proponent of Hamlet-as-Shakespeare is Freud, and if that doesn't set off alarm bells I don’t know what to tell you.
Other answers are correct in noting that Oxfordians are the people most likely to claim a connection between Hamlet and Shakespeare. Oxford's father died and his mother remarried, and he was captured by pirates, which is “compelling" evidence for that affinity, if you believe it. Gielgud was cagey about his true loyalties, but he did lend his name to several Oxfordian groups, if not his support. In that case, his theory of Hamlet as Shakespeare takes on a different shade.
If Shakespeare saw himself in Hamlet, surely he would have played Hamlet on the stage. But all we know of his acting is that he played some “kingly parts," which makes the ghost of Hamlet Sr. a more likely role.
But what could Hamlet and Shakespeare possibly have in common? His father died peacefully of old age and Will inherited his estate — after Hamlet was written, if you subscribe to the commonly accepted timeline placing its composition around 1599. Hamlet is a terrible poet; see the laughable ditty he writes for Ophelia. He likes the theatre, sure, but he has no patience for it, constantly interrupting and interfering (Michael Creamer provides the one passage I do believe could be Shakespeare's own opinions shining through, but any passage in any play could be Shakespeare's own opinions shining through and we couldn't know.)
The character of Hamlet was too self-absorbed, too paralyzed by his own fears, and too schmaltzy in his poetry to have written Shakespeare.
please follow me