King:Hamlet Act 3, scene 3, 36–39
O, my offense is rank, it smells to heaven,
It hath the primal eldest curse upon't—
A brother's murther. Pray can I not,
Though inclination be as sharp as will.
The fear of God has been put into King Claudius by a little drama piece Hamlet produced at court. As Hamlet had hoped, the play—which recreated Claudius's fratricide—caught Claudius's conscience [see THE PLAY'S THE THING]. In this soliloquy, Claudius confesses the deed and recoils at its smell. It is "rank" (that is, "rancid"), so rank that the vile odor wafts all the way to heaven. Thoughts of heaven remind him that his crime is the same as Cain's, a crime marked by the "primal eldest curse." Unfortunately for Claudius, although his inclination to repent is as "sharp as will" (is as keen as a desire), he's unable to pray for forgiveness, because he's unwilling to forfeit his ungodly gains.
So while Claudius is metaphorical about the "smell" of his deed, he is grimly literal about heaven's reaction. We, on the other hand, treat heaven as part of the metaphor. "It smells to heaven" has become pure hyperbole, a grander version of "it stinks."