Twelve-year-old Josh Baskin, who lives with his parents and infant sister in Cliffside Park, New Jersey, is told he is too short for a carnival ride called the Ring of Fire, while attempting to impress Cynthia Benson, an older girl. He puts a coin into an unusual antique arcade fortune teller machine called Zoltar Speaks, and makes a wish to be "big". It dispenses a card stating "Your wish is granted", but Josh is spooked to see it was unplugged the entire time.
The next morning, Josh has been transformed into a 30-year-old man. He tries to find the Zoltar machine, only to see an empty plaza, the carnival having moved on. Returning home, he tries to explain his predicament to his mother, who refuses to listen, thinking he is a stranger who kidnapped her son. Fleeing from her, he then finds his best friend, Billy Kopecki, and convinces him of his identity by singing a rap that only they know. With Billy's help, he learns that it will take a couple of months to find the machine, so Josh rents a flophouse room in New York City and gets a job as a data entry clerk at MacMillan Toy Company.
Josh runs into the company's owner, Mr. MacMillan, at FAO Schwarz, and impresses him with his insight into current toys and his childlike enthusiasm. They play a duet on a foot-operated electronic keyboard, performing "Heart and Soul" and "Chopsticks." This earns Josh a promotion to a dream job: getting paid to test toys as Vice President in Charge of Production. With his promotion, his larger salary enables him to move into a spacious luxury apartment, which he and Billy fill with toys, a rigged Pepsi vending machine dispensing free drinks, and a pinball machine. He soon attracts the attention of Susan Lawrence, a fellow McMillan executive. A romance begins to develop, to the annoyance of her ruthless boyfriend and coworker, Paul Davenport. Josh becomes increasingly entwined in his "adult" life by spending time with her, mingling with her friends, and being in a steady relationship. His ideas become valuable assets to MacMillan Toys; however, he begins to forget what it is like to be a child, and he never has time to hang out with his best friend Billy because of his busy schedule.
MacMillan asks Josh to come up with proposals for a new line of toys. He is intimidated by the need to formulate the business aspects of the proposal, but Susan says she will handle the business end while he comes up with ideas. Nonetheless, he feels pressured, and longs for his old life. When he expresses doubts to her and attempts to explain that he is really a child, she interprets this as fear of commitment on his part, and dismisses his explanation.
Josh learns from Billy that the Zoltar machine is now at Sea Point Park. He leaves in the middle of presenting their proposal to MacMillan and other executives. Susan also leaves, and encounters Billy, who tells her where Josh went. At the park, Josh finds the machine, unplugs it and makes a wish to become "a kid again." He is then confronted by Susan, who, seeing the machine and the fortune it gave him, realizes he was telling the truth. She becomes despondent at realizing their relationship is over. He tells her she was the one thing about his adult life he wishes would not end and suggests she use the machine to turn herself into a little girl. She declines, saying that being a child once was enough, and takes him home. After sharing an emotional goodbye with Susan, he becomes a child again. He waves goodbye to Susan one last time before reuniting with his family. The film ends with Josh and Billy hanging out together, with the song "Heart and Soul" playing over the credits.

Question: Why was Josh spooked when the machine dispensed a card?
Answer: The machine was unplugged.