I don't know which occurred to me first, but i have always thought there were two possible origins of the phrase: a metal form, as in Tool & Die Co, or throwing dice. I have come over time to consider the latter more likely, but never looked it up. My wife looked it up at my request as we were driving over to see the Black-Bellied Whistling Duck, which has caused excitement among birders up here in NH because it is seldom seen north of Texas and Florida.
It is indeed about casting dice. Suetonius attributed the first use to Julius Caesar, but later writers have picked up the reference in the Greek poet Menander, who was reportedly a favorite of the general. Caesar used iacta alea est, "let the die be cast" as he was crossing the Rubicon River on his way toward Rome with his own army, certain to provoke civil war. It is ironic that our other metaphor for the idea "it's too late now!" is Crossing the Rubicon, from the same incident.