In Chapter 1, David compares Mr. Chillip, the doctor who delivers him, to the Ghost of Hamlet. This allusion is one of a great many allusions to Shakespeare's Hamlet:
He was the meekest of his sex, the mildest of little men. He sidled in and out of a room, to take up the less space. He walked as softly as the Ghost in Hamlet, and more slowly. He carried his head on one side, partly in modest depreciation of himself, partly in modest propitiation of everybody else.
The Ghost in Hamlet is Hamlet's dead father, who only appears to a select few characters but who catalyzes the entire plot of the play. The Ghost urges Hamlet to avenge his death. Hamlet quickly pieces together the mystery. Hamlet's father was the King of Denmark. Hamlet's uncle, Claudius married Hamlet's mother, Gertrude, right after the King died. As the widow to the now deceased King, Gertrude stands to offer quite a lot to Claudius. Hamlet spends the play believing (against the reassurances of most of the people around him) that Claudius killed his father. At the Ghost's bidding, Hamlet dedicates himself to taking his uncle and stepfather down.
The comparison between Mr. Chillip and the Ghost is somewhat ironic. Mr. Chillip is like the Ghost not because he is urging anyone on to avenge him, but because he is so mild-mannered that he's practically unnoticeable. Still, the allusion kicks off an allegory that runs throughout the novel, sometimes serious and sometimes ironic. Chillip delivers the news that David is a boy, which leads to Miss Betsey abandoning her plan to raise Clara Copperfield's baby. David thus gets stuck with Mr. Murdstone as a stepfather. Like Hamlet, David's antagonist is his stepfather. Like Hamlet, he is largely alone in his battle because Victorian society refuses to take domestic abuse seriously.
Many side characters in David Copperfield stand in for side characters in Hamlet. For instance, Dora is like Hamlet's love interest, Ophelia: neither David or Hamlet manages to set aside their own obsessions to properly care for their love interests, and both women end up dead. Mr. Micawber, meanwhile, frequently offers platitudes, just like Ophelia's father, Polonius, does. Both Micawber and Polonius are ultimately good people who get caught up in the plot as advisors to villains (Polonius to Claudius, and Micawber to Uriah Heep).
The stakes in David Copperfield are sometimes much lower than they are in Hamlet because David is just an ordinary person, not a Danish Prince. It would be difficult for anyone's life to have the heightened stakes of Hamlet's. Where David's story most differs from that of Hamlet is the happy ending. Part of David's development is outgrowing Mr. Murdstone as an antagonist. By the end of the novel, David has gained his independence and no longer must worry about his abusive stepfather. The end of Hamlet, on the other hand, is a bloodbath. Nonetheless, the similarities between their lives begs readers to take David's struggles seriously. For a child who grows up in an abusive environment without much of a social safety net, Dickens seems to be arguing, life can be almost as difficult as it is for the ultimate Shakespearean tragic hero.