Claudius and Polonius have different motives for spying on Hamlet when the Prince has his meeting with Ophelia. Claudius is not convinced that Hamlet is mad, but he is diligently exploring every possible explanation of his stepson’s strange behavior because he is afraid it threatens him. He tells Polonius:
There's something in his soul,
O'er which his melancholy sits on brood,
And I do doubt the hatch and the disclose
Will be some danger . . .
Polonius is rather simple-minded. It doesn’t occur to him that Hamlet could only be acting mad because, unlike Claudius, he has no suspicions or guilty knowledge. He can’t see why Hamlet would be acting mad unless he were truly mad, whereas Claudius can understand that Hamlet could be acting mad as part of a plan to stage a coup or an assassination. Polonius, of course, would like nothing better than to have his daughter marry Hamlet. This is the opportunity of a lifetime for Polonius, Ophelia, and Laertes. Hamlet would become king eventually and his daughter queen. The whole family would achieve royal status. Polonius could exercise great power through his influence over his loving and obedient daughter. If Hamlet were a little bit mad, that would only give Polonius more power.
In their spying on Hamlet with Ophelia, both Claudius and Polonius reveal their characters and motives. Both of them are keenly interested in the relationship between the young people for different reasons. Claudius would be vastly relieved if he learned that Hamlet was really mad because of his love for Ophelia. No doubt he would encourage them to get married and he would feel vastly relieved of his fears and suspicions. Unfortunately for both Claudius and Polonius, Hamlet does not play the part of the passionate lover because he apparently suspects that he is being spied upon. Claudius will have to go on wondering and worrying throughout the remainder of the play.