In Act 1, scene, 2, Claudius says to Hamlet:
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.
Partly, the King means what he says; he wants Hamlet to stay to win him over, to make Hamlet see him as his new father. More likely, though, because of the knowledge of his own guilt, he wants to keep an eye on the dark, brooding Prince. He fears that, in the future, Hamlet may present a danger to him.
By Act 3, scene 1, Claudius has given up all hope of winning Hamlet over, and knows that he is to be feared:
It shall be so.
Madness in great ones must not unwatch'd go.
Subsequently, the King believes that Hamlet is a real threat to him and makes plans to have him sent to England to be killed (Act 3, scene 4):
Follow him at foot. Tempt him with speed aboard.
Delay it not; I'll have him hence tonight.
Away! for every thing is seal'd and done
That else leans on the affair. Pray you, make haste.
And, England, if my love thou hold'st at aught—
As my great power thereof may give thee sense,
Since yet thy cicatrice looks raw and red
After the Danish sword, and thy free awe
Pays homage to us—thou mayst not coldly set
Our sovereign process, which imports at full,
By letters congruing to that effect,
The present death of Hamlet. Do it, England;
For like the hectic in my blood he rages,
And thou must cure me. Till I know 'tis done,
Howe'er my haps, my joys were ne'er begun.
Keeping Hamlet in Elsinore, no longer seems like a good idea to treacherous King Claudius