The sources for Shakespeare's texts were numerous -- he himself had his "foul" ("working") copies, the actors had "cue scripts," and finally there was the "fair" copy of the completed play. After his death his plays were published in the First Folio.
What has been termed the "Bad" quarto most likely derived from actor's memory of the text, or from earlier "foul" copies. At the first link, you can actually see, side by side, the differences between Q2 and "Bad".
The most notable difference is that Hamlet's soliloquy is much reduced from what we're used to; most of the imagery is missing, along with most of the words. The iambic pentameter meter he wrote in also mostly missing; clearly this suggests a working copy or a misremembered recitation from among the first actors playing Hamlet.