From the Super Mario Wiki
In The Super Mario Bros. Super Show! episode "20,000 Koopas Under the Sea", the Koopilus first appeared in Happy Harbor to destroy and devour a ship, before trying to attack Mario, Luigi, Toad and Princess Toadstool, who were on a nearby dock. The Koopilus succeeded in only creating a large wave that swept Mario, Luigi, Toad and Princess Toadstool away, into Happy Harbor.
King Koopa, wanting to takeover Happy Harbor, began to cause more havoc there with the Koopilus; it was King Koopa's plan to make the Koopilus resemble a sea monster and use it to attack Happy Harbor, which he promised to save from the Koopilus if the inhabitants made him their ruler. This plan of King Koopa's was ruined due to the intervention of Mario, Luigi, Toad and Princess Toadstool and Captain Abidab, who revealed King Koopa's malevolent attitude before they decided to hunt for the Koopilus themselves.
While venturing underwater, Mario, Luigi, Toad, Princess Toadstool and Captain Abidab were ambushed by the Koopilus, which Mario managed to hit on the head with a plunger, with a rope attached to it, launched from a harpoon gun. Mario, as well as Luigi and Princess Toadstool, who had grabbed Mario's feet, were subsequently dragged through the water by the Koopilus. It was only when the Koopilus dived under an arch-shaped rock that the rope attached to it broke, dropping Mario, Luigi and Princess Toadstool on to the ocean floor. As Mario, Luigi and Princess Toadstool tried to run away, the Koopilus devoured them.
Seeing Mario, Luigi and Princess Toadstool eaten by the Koopilus, Toad and Captain Abidab fled from the approaching Koopilus, which ignored them as they hid in a pit. Following the Koopilus to the surface, Toad and Captain Abidab managed to catch sigh of it as it bashed into Captain Abidab's ship, the Peapod, before it submerged once more. On the inside of the Koopilus, Koopa Nemo appeared before Mario, Luigi and Princess Toadstool and revealed that the Koopilus was a submarine and that he planned to use it to destroy Happy Harbor; after revealing all this, Koopa Nemo proceeded to make Mario, Luigi and Princess Toadstool his galley slaves and make them peel onions in the kitchen of the Koopilus.
When Koopa Nemo began his attack on Happy Harbor, starting with the ships near it, Captain Abidab managed to launch Toad into the Koopilus's mouth, after the two received a message in a bottle from Mario that revealed the Koopilus's true nature. Once inside the Koopilus, Toad managed to locate and free Mario, Luigi and Princess Toadstool, only to be chased from the Koopilus by four of Koopa Nemo's Bloober minions.
The Koopilus eventually met it's end when Super Mario and Super Luigi, after defeating Koopa Nemo's Bloober henchmen, leapt from the water and on to the Koopilus's head, where Koopa Nemo saw them through the Koopilus's periscope. After several attempts to shake Mario and Luigi off the Koopilus, Koopa Nemo succeeded in doing so, only to lose control of the Koopilus and crash it into Happy Harbor, where it exploded.