Gay men in deep mourning weren’t in the mood to take any crap from the cops. Judy Garland was (and is, to some segments of the gay community) a beloved icon. When they raided the Stonewall, the patrons fought back.
From what I’ve seen, this is mostly an urban legend made up after the fact.
The people who were actually there at the Stonewall Inn those nights have generally said that Judy Garland’s funeral didn’t enter into their minds at all during this period.
Although this particular piece of folklore is very well known, every time I’ve heard it it’s been presented as folklore, e.g. “Legend has it that they were on edge…”
I have seen and read a number of interviews with people who were there who say different. How much of that is self-revisionism I don’t know, but there does seem to have been at least some consciousness on the first night of the riots of Garland’s funeral among the patrons. There doesn’t seem to have been a “Judy’s dead and now this!” mentality as implied by the movie Stonewall (a fictionalization of the book of the same title by Martin Duberman) and certainly after the first night it’s unlikely that anyone was thinking about Garland’s funeral; ultimately it’s really impossible to prove one way or the other.