From the Super Mario Wiki
The origin of the Excalibur is unknown, though Mervin the Magician seems to have some knowledge of it. The Excalibur is located in a lake in the Forest of Perpetual Night and Terrible Dangers. In "King Mario of Cramalot / Day of the Orphan", the Excalibur was summoned when a bolt of lightning struck the lake it was hidden in; this lightning bolt raised a hand out of the lake, which proceeded to toss the Excalibur to Mario.
Later, Mario used the Excalibur against King Koopa and his Golden Plunger; in the end, the Excalibur proved to be more powerful than the Golden Plunger and King Koopa was defeated. What became of the Excalibur afterwards is unknown.
The Excalibur seemed to possess a wide variety of abilities, by simply touching it, Mario was transformed into Super Mario. The Excalibur could also switch between being very flexible to being stiff and sword-like. The Excalibur could also extend and be used like a grappling line.