While not referred to by any name in the film, the Magic Sword is based on Dyrnwyn, a magic sword that features prominently in the Chronicles of Prydain, the book series which the film was based on. Like it's counterpart in the novel, the Magic Sword possesses a powerful magic that manifests as flaming energy whenever its edge strikes something, allowing it to cut and burn its way through even heavy iron chains. It can also float and fight of its own accord.
After escaping the Horned King's dungeon, Taran discovers the Magic Sword entombed in the castle's crypt along with its owner, the castle's original king. With the aid of the Sword's power, Taran and his companions manage to escape the castle and continue their quest to find the Black Cauldron before the Horned King can claim it. Upon locating the three witches who possess the Black Cauldron, Taran is forced to trade the Sword for it, only to find out that it was all a plot by the witches in an attempt to take both it and the Magic Sword for themselves. At the film's end, following the sacrifice of Gurgi and the defeat of the Horned King, the Witches offered to take back the now powerless cauldron until Taran's companion Flam turns their plan back on them by demanding a fair trade as they originally did. Reluctantly, the witches offered to return the Magic Sword in exchange for the cauldron, but Taran rejected their offer and instead bartered for Gurgi to be revived.
In the original novels, Dyrnwyn was found in the dungeon of the enchantress Achren instead of the Horned King
Dyrnwyn in the original novels had a blade that had been stained black by its previous wielder, a king who had fallen into madness and used it to murder an innocent shepherd.
A deleted scene identifies it (and by extension its deceased owner) as the Sword of King Gwydion, a reference to the Prince Gwydion character in the original novels.