This is like a double-triple of misunderstanding and a perfect comedy nugget, obscured, perhaps by the triple confusion.
We read this sentence in this era and we might think Polonius is asking after Hamlet’s mental state as if he were upset and he were asking why.
We eventually determine that he’s referring to the content of Hamlet’s book but it is a rather curious way to ask a person what he’s reading.
Now we’d say, “What are you reading?” or “What’s it about?” or even, “What’s the book?” if we’re being casual.
So the joke might be on us, because Hamlet misunderstands (on purpose, we might assume) in a way that is similar to the way we might misunderstand in thinking of matter as a problem but he complicates it as if something the matter were only something that could happen between people.
And so Polonius breaks it down for us, for him, eventually. But for any of us to understand this now, we’d have needed this bit from the beginning.
And that’s partly the genius of the thing. If Hamlet answered as we’d expect, he might say, “Nothing’s the matter. I’m just fine. . .” or “I don’t know what you mean.”
All of which would kill any hope of comedy.
For it to be funny, misunderstanding is necessary.