Why does Shakespeare create the three parallel sets of fathers and sons in Hamlet?
Old King Hamlet kills Old King Fortinbras. Claudius kills Old King Hamlet. In attempting to kill Claudius, Hamlet kills Polonius. Laertes tries to avenge Polonius but is killed by Hamlet. Hamlet still wants to avenge his father by killing Claudius and Young Fortinbras wants to avenge his father by killing the heir (Claudius or Hamlet). Chaos.
Hamlet poses his most famous existential question, "to be or not to be" as a decisive moment: to end his life or to tackle the disorder of Denmark by avenging his father's death. In the larger picture, Hamlet is also attempting to put a definitive end to this pattern of killing and avenging. Literally, this is about escaping this pattern of unnatural (murder) deaths. Opposing this unnatural pattern is the natural order of life which is father (and mother) to son (and daughter). Barring murder, people tend to grow old and die of natural causes. But so many characters (Old King Hamlet, Old King Fortinbras, Polonius, Laertes, Ophelia, Gertrude, Claudius, and Hamlet) die of unnatural causes and thus, too early. To die unnaturally is to upset the natural or familial order of life. And with murder, it is to upset the order of law. With a king being killed, this upsets the order of the royal line, the order of authority. Each son must deal with the loss of his father but also the loss of familial and social order.
Paralleling the three sets of fathers and sons, Shakespeare provides three examples where this natural order is upset. Feeling so distraught at his father's death and his mother's "unnatural" (incestuous) and quick marriage to Claudius, Hamlet seeks not only revenge but to reestablish some kind of order.
The time is out of joint--O curse spite,
That I was ever born to set it right. (I.v.188-89)
In Act One, Marcellus famously says, "Something is rotten in the state of Denmark." (I.iv.99) Something is wrong with the political "state" of Denmark (the king has been murdered) and something is wrong with the social and spiritual "state" of Denmark (the king's ghost haunts and demands Hamlet to avenge him).
Each son (Hamlet, Laertes, and Fortinbras) tries to avenge his father out of love and duty but also to reestablish the order of these political, familial, and spiritual "states." When all is said and done and many are unnaturally killed, Fortinbras takes the throne of Denmark and proposes to begin a new state of order.