The King doesn't like it that Hamlet, all dressed in black, seems to be so depressed and has been moping around the castle. In Act 1, scene 2, after telling Hamlet that it's OK to still love his dead father and all but it's time to cheer up and move on, the King says:
We pray you throw to earth
This unprevailing woe, and think of us
As of a father; for let the world take note
You are the most immediate to our throne,
And with no less nobility of love
Than that which dearest father bears his son
Do I impart toward you. For your intent
In going back to school in Wittenberg,
It is most retrograde to our desire;
And we beseech you, bend you to remain
Here in the cheer and comfort of our eye,
Our chiefest courtier, cousin, and our son.
It seems that he is asking Hamlet to stay in Elsinore so that he can eventually come to see Claudius as his new loving father.
It's far more likely that this is but an excuse. Claudius, at this point, is the only one who knows that he has murdered his brother by pouring poison in his ear. He doesn't like it one bit that the son of the man he killed and of the woman he has just married is unhappy. It bothers him greatly; it's a loose end of his deed which he feels he needs to attend to, something he has to keep an eye... to see if something develops in Hamlet that may be of danger to him.
Thus it is a secret expression of The King's guilt and fear that makes him want to keep Hamlet close by. Soon he will enlist spies in his service to keep a wary on the melancholy prince.