Osric is undoubtedly a foolish fop, but his mission is extremely serious. He has been sent there to invite Hamlet to have a fencing match with Laertes, who we already know is colluding with King Claudius to kill Hamlet either with a poisoned foil or, if that should fail for any reason, then with a poisoned drink. There is an extremely sinister plan in progress. Evidently it is Claudius who has commissioned Osric to extend the invitation to Hamlet, and it will be Osric who will act as referee of the match. The King is well aware that Osric is a weak, comical character. He will make the audience laugh when Hamlet makes fun of him. The wily King deliberately chooses an emissary who seems funny, stupid, and ineffectual just because this will help to disguise the ulterior purpose of the proposed fencing match. Hamlet thinks this is just going to be amusement. He might be suspicious of the King, but he is not suspicious of Laertes. He doesn't know how the devilish Claudius has gotten to young Laertes. The audience is also somewhat diverted by the comic relief and may temporarily forget that Laertes and Claudius have decided to kill Hamlet—and this is it! Osric, of course, is a fool and doesn't realized how he is being used for a sinister purpose.
In Act V, scene 2 of Hamlet, Osric is the silly courtier sent by Claudius to summon Hamlet to a duel with Laertes. Osric is the kind of courtier who royalty put up with because he is rich. Hamlet says of him, "Let a beast be lord of beasts and his crib shall stand at the king’s mess." In other words, Osric is basically a beast, but because he is wealthy, he is welcome at the king's table. Hamlet also refers to Osric, when speaking to Horatio, as a "water-fly," a type of insect, so Osric is the type of man who lives off others.
Osric is a satirical figure who agrees with whatever Hamlet says. He first says it's hot, and then when Hamlet says it's cold, Osric agrees. He is essentially a superficial person. As Hamlet describes him, "But blow a little on this bubbly talk, and it’ll burst. There’s no substance here."
The reason that Shakespeare may have included Osric in the play was to poke fun at the English court, which was filled with figures who flattered royalty and were superficial. Shakespeare included references to life in the English court to please his patrons, first Queen Elizabeth and, after her death in 1603, James I.
Osric is a courtier in the Danish court and in Act 5, sc. 2, he is the one who comes to Hamlet with the challenge, put forth by Laertes, to a fencing match. Osric is shown to be a sycophant as he speaks in superlatives of Laertes and especially in the taking off and putting back on of his hat as Hamlet first tells him to put his hat on and then to take it off. Osric agrees with everything Hamlet says even when it contradicts what Hamlet had said previously. In this way, he serves as a source of the ridiculous type of people that Claudius has in his court. Osric is overdressed and tries to speak pompously and he is shown, in the end, to simply be a ridiculous person. This shows the disintegration of the Danish court under Claudius' rule.