From the Super Mario Wiki
When Mario returns to Toad Town after recovering the third Star Spirit, Skolar, from Lady Bow, Mario is surprised to find Shy Guys running rampant throughout the town, stealing items and causing mischief among the townsfolk. As Mario approaches Rowf and Rhuff’s Badge Shop, one of the Shy Guys steals the Calculator and takes it to hide somewhere in Shy Guy's Toy Box.
Unfortunately, Rowf and Rhuff cannot run the badge shop without the Calculator. After Mario enters Shy Guy's Toy Box and defeats the Shy Guy who had the Calculator, he returns it back to Rowf and Rhuff. As thanks for returning the Calculator, Mario receives an I Spy Badge as a reward. When Mario later returns to the badge shop, the shop has reopened.