This way his uncle (step father, the king) would 'worry' about him and see what was wrong with him, and in doing so hamlet could easily come to the truth about his father's murder. Also, at the end it gives him some excuse to push his gf away and kill his uncle.