According to actor Robert Loggia, on the day they filmed the famous keyboard scene at F.A.O. Schwarz, he and Tom Hanks noticed that doubles dressed like them were on hand just in case the two could not do the dance moves correctly. It became their goal to do the entire keyboard number without the aid of the doubles. They succeeded.
Tom Hanks was the first choice to play Josh Baskin but was unavailable due to scheduling conflicts with the films Dragnet (1987) and Punchline (1988). Robert De Niro was then offered the lead role, and was rejected because his salary demand ($6 million) was too high. Tom Hanks then became available and accepted the lead role for $2 million. David Moscow was originally cast not as young Josh, but as Billy, since he didn't look like Robert De Niro. When Tom Hanks was given the role, David Moscow was recast as young Josh.
In preparation for the role, Tom Hanks met David Moscow and studied videotapes of him to see how he behaved and spoke. Tom Hanks also felt that David Moscow should just be himself so that the Josh Baskin character persona would be that of a real 12-year-old.
The scenes in Josh's neighborhood were filmed in Cliffside Park, New Jersey. The amusement park scene in the beginning of the movie where the wish was made was filmed at Ross Dock Picnic Area on the Hudson in Fort Lee. It is not an amusement park but was set up as one. The George Washington Bridge can be seen clearly in some of the shots. The scene at the end where he finds the machine were filmed on the pier at Rye Playland, in New York's Westchester County.
According to Monica Rushton, Jared Rushton (Billy), David Moscow (little Josh) and Tom Hanks (big Josh) were put in a room with a bunch of toys to play with. Having silly string, they tried to use it to gross each other out and that is how the silly string scene between Jared Rushton and Tom Hanks appeared in the movie.
The offices of an actual advertising agency on 23rd Street in the Chelsea district in New York City was used for the scenes involving the fictitious MacMillan Toys Company, which were very hard on both the film crew and the actual workers of the agency. The location fee of $25,000 was donated to the American Craft Museum by the agency and Twentieth Century-Fox.
The "Walking Piano" used in the film's trademark scene was created by an Italian inventor named Remo Saraceni. Mr. Saraceni's many musical inventions grace children's organizations worldwide. As of 2008, his famous Walking Piano is currently being implemented into a piano instructional game called Piano Wizard made by Allegro Multimedia.
In the film, Josh comes up with the brilliant idea of robots that transform into prehistoric, giant insects. His description is nearly identical to the Insecticons, a group of robots from The Transformers toy line. The Insecticon toys were released three years before the film.