The play within a play, titled *The Mousetrap*, depicts a king being poisoned by his brother while sleeping in his garden. This plot mirrors the actual murder of Hamlet's father, King Hamlet, by Claudius.
Therefore, King Gonzago represents a symbolic figure who allows Hamlet to test Claudius's guilt and reveal the truth of the murder.