You are describing Big (1988), directed by Penny Marshall.
Tom Hanks plays Josh Baskin, a 12-year-old who wishes to be "big" at a carnival machine. He wakes up as a 30-year-old man (Hanks) but retains the mind, emotions, and wonder of a child, leading to comedic and poignant fish-out-of-water scenarios in the adult corporate world.