From the Super Mario Wiki
Mario and Luigi run into the captain by accident, because a police helicopter they are riding in to face Raccoon Koopa is knocked down by him, landing in the Seine. The captan's submarine surfaces for the helicopter to land on as it hits the water, and the captain himself is hastily introduced to Mario and Luigi.
The captain tries to get himself, Mario and Luigi away from Raccoon Koopa by submerging the submarine, but Bowser becomes Frog Koopa in order to swim after them. Frog Bowser succeedes in kicking the submarine ashore, and apprehends Mario, Luigi and the captain by throwing them in the Bastille.
Until Toad comes to the rescue, the captain waits around in the group's jail cell while Luigi unsuccessfully tries to dig a way out. When Toad arrives, he dropped off a birthday cake with a Super Block hidden inside. Inside the block is a Super Leaf, which Mario uses to become Raccoon Mario, and is able to use his tail to break out of the cell, freeing himself, Luigi and the captain. After Toad presents Luigi with a Super Leaf of his own, he and Mario fly off, while the captain salutes them for saving his native country of France.