There's actually not as much here as one may think. The similarity of the name of the main character "Hamlet" and the name of Shakespeare's son "Hamnet", who died at age 11, is often debated. Some think the connection is obvious; others argue that "Hamlet" & "Hamnet" were popular names at the time & virtually interchangeable.
One incident that might be more closely connected was the drowning death of a woman named Katherine Hamlet in a nearby village when Shakespeare was 15. It was not clear if her death was accidental or suicide, and this seems to be the basis for Ophelia's death in the play. Of course, it becomes a matter of contention whether she intended to kill herself or not, & suicide was a serious issue with regard to Christian burials.
Finally, the acting/player motif that runs through the play is obviously based on Shakespeare's own experiences in the theatre. Rosencrantz's explanation of the "war" between the adult companies and those made entirely of boys was an actual battle being fought in London's theatres and among the traveling companies. It is also commonly thought that Hamlet's advice to the players is Shakespeare speaking through his character. Essentially, it is as close as he comes to telling the audience his ideas on acting and the theatre.