Why would Hamlet describe Denmark as a prison in Shakespeare's Hamlet?
In act 2, scene 2, Rosencrantz and Guildenstern meet with Hamlet for the first time since returning to Denmark, and Hamlet proceeds to ask them why they've chosen to visit a prison. When they question Hamlet about his comment, Hamlet reiterates that Denmark is a large prison with many cells and dungeons. Hamlet refers to Denmark as a prison, because he feels trapped and isolated in the kingdom and cannot leave to attend the University of Wittenberg. Hamlet is under Claudius's constant supervision as Polonius, Rosencrantz, and Guildenstern spy on him. Similar to a prisoner, Hamlet feels like he is in danger because he lives in close proximity to the man that murdered his father. Hamlet cannot trust anyone, except for Horatio, and feels completely alienated in Denmark. Similar to a prisoner, Hamlet is not free to travel and is constantly followed by Claudius's subjects. Overall, Hamlet compares Denmark to a prison because it is a dangerous, ominous place, where he is under Claudius's constant supervision and cannot trust anyone.
Hamlet's description of Denmark as a prison has mainly to do with his feelings about the place after his father's murder. He longed to return to his studies and the relative moral quiet of Wittenburg but was urged to stay by his mother, to whom he obviously feels a great loyalty, as well as by the desire to see if he can figure out and avenge his father's murder.
Because of this, he feels he is confined there and cannot be free, thus the feeling that it is a prison. This comes out several times in the play, perhaps the most blatant when he is speaking to Rosencrantz and Guildenstern.