“I read somewhere that nunnery in this case meant brothel.”
I don’t think so. That sounds like the kind of thing despicable leftard scoundrels invent.
I just looked up some online analyses of this passage. The longest and most serious one concluded that Shakespeare meant “nunnery” in its normal meaning here, but there is evidence of it being used in the other meaning in this time period (by Thomas Nashe, 1567-1601).
You would be incorrect, then. The backlash against Catholics (along with the nationalization of the church by Henry VIII) meant that all convents had been abolished in England by the time of Elizabeth I. So no one could have gotten to a nunnery, as they were officially banned. And before you respond with "But maybe Shakespeare was trying to be historically accurate for Denmark in Hamlet's time," it would be the first time for the Bard. He was notoriously anachronistic in his plays, emphasizing understandability for his contemporary audience. They had very different expectations than modern audiences do (or considering most "historical" movies nowadays... maybe not).
Because of the anti-Catholic sentiment of the time, "nunnery" was a well-known slang for brothels. It described a place where only women lived, plus got in a Papist slur in the bargain. It shows up used that way in dozens of Elizabethan plays and texts, by many different authors. So you are categorically wrong.