Shakespeare's main source is believed to be an earlier play-now lost-known today as the Ur-Hamlet.
It is clear, though, that several elements did change somewhere between Belleforest's and Shakespeare's versions.