Early on, it's declared that something is rotten in the state of Denmark. We're told that Claudius is the corrupted unjust ruler of Denmark and hellbent on keeping the throne at all costs. If Denmark is a considered a garden, Claudius, the gardener, is not tending it properly with his corrupt ways, thus, leading to the inevitable decay. You might even say Claudius is a weed.
Another way to look at the metaphor of the garden is that Denmark is to represent the Garden of Eden and the fall of man. When the Ghost tells Hamlet how he was murdered, he refers to Claudius as a serpent. What followed was Claudius's seduction of Gertrude and King Hamlet's death.
'Tis given out that, sleeping in my orchard,
A serpent stung me, so the whole ear of Denmark (I.5.35)
When I really got engaged with the garden metaphor, I realized that the 1994 film The Lion King really painted it well on screen.
Before:
After:
Ultimately, Hamlet wants to reclaim his garden and restore good health to the nation of Denmark.
Travis