The Hamlet story originates from a Scandinavian legend (6th–8th centuries). The earliest written version is Saxo Grammaticus's Gesta Danorum (12th century). Shakespeare's famous play dates to 1599–1601, drawing on earlier versions like the anonymous The Tragicall Historie of Hamlet, Prince of Denmarke (pre-1589). Thus, the tale has evolved over centuries from Nordic folklore to Shakespeare's iconic version.