Prior to Murray's casting, Tom Hanks  and Michael Keaton  turned down the lead role. In the original screenplay by Danny Rubin, the story line began mid-narrative with Phil already inexplicably trapped in the time loop, and ended with his suicide, only to awaken on the morning of February 2 once again. In that version, Rita eventually confessed to being trapped in a time loop of her own. Many critical script alterations were written as filming progressed, according to Stephen Tobolowsky, who played Ned Ryerson. "When I got the part, it was still kind of a mediocre Bill Murray movie," he said. "You know, Bill Murray, with no consequences, in comic situations ... It wasn’t until we got into the shooting that everything turned on its head. And it became not only a good movie, not only a great movie, but a classic."
During filming, Ramis and Murray's longtime collaboration and friendship ended abruptly, without public explanation. Except for a few words at a wake, and later at a bar mitzvah, the two men did not speak for almost 20 years after the film's release. Murray finally initiated a reconciliation—at the suggestion of his brother—only after Ramis entered the final stages of his terminal illness.
The film was shot in Woodstock, Illinois, 60 miles (97 kilometres) northwest of Chicago near the Wisconsin border, because Punxsutawney "didn’t have a town center that looked good on camera", according to Ramis, and because Punxsutawney's remote location magnified the logistical problems and expense of filming there. Punxsutawney officials, miffed that their town had been passed over, refused to allow the real Punxsutawney Phil to appear in the movie, but sent representatives to Woodstock to make sure the ceremony was being depicted accurately. (Punxsutawney's actual Groundhog Day celebration is held not in the town itself, but in a clearing atop a wooded hill called Gobbler's Knob, about 2 miles (3.2 kilometres) southeast of Punxsutawney.)
Punxsutawney Phil was played by a series of groundhogs collectively known as Scooter. "[The animals] hated my guts from day one," said Murray, who was bitten twice during shooting, severely enough that he was forced to undergo precautionary rabies immunization afterward.
The Tip Top Cafe, where many indoor scenes took place, was a set created for the film; but it became an actual restaurant, the Tip Top Bistro, following the movie's success. Later, it became a coffee and Italian ice cream shop, and after that a fried chicken outlet. The Cherry Street Inn, the Queen Anne-Victorian bed & breakfast where Murray's character stayed, was a private home at the time of filming. Today, it is an actual bed & breakfast.
Since 1992, Woodstock has staged an annual Groundhog Day festival, featuring a dinner dance, free screenings of the movie, and a walking tour of the opera house, bowling alley, movie theatre, Moose Lodge (site of the dinner dance scene), piano teacher's house, Cherry Street Inn, and other locations from the film.
Time loop duration speculations
Estimates regarding how long Phil supposedly remains trapped in the loop, in real time, vary widely. During filming, Ramis, who was a Buddhist, observed that according to Buddhist doctrine, it takes 10,000 years for a soul to evolve to its next level. Therefore, he said, in a spiritual sense, the entire arc of Groundhog Day spans 10,000 years. In the DVD commentary, Ramis estimated a real-time duration of 10 years. Later, Ramis told a reporter, "I think the 10-year estimate is too short. It takes at least 10 years to get good at anything, and allotting for the down time and misguided years he spent, it had to be more like 30 or 40 years." In 2005, Rubin said, "Ultimately it became this weird political issue because if you asked the studio, 'How long was the repetition?', they'd say, 'Two weeks'. But the point of the movie to me was that you had to feel you were enduring something that was going on for a long time ... For me it had to be—I don't know. A hundred years. A lifetime." In 2014, the website WhatCulture combined various time duration assumptions and estimated that Phil spent a total of 12,395 days—just under 34 years—reliving Groundhog Day.