During the climax of Pokémon Sword, the player's Rusted Sword, along with Hop's Rusted Shield, summons Zacian and Zamazenta to help the two Trainers to battle against Eternamax Eternatus at the Tower Summit. The Rusted Sword temporarily becomes Zacian's held item for the duration of this battle. During the post-game, the player returns the Rusted Sword to Slumbering Weald. It is soon after temporarily stolen by Sordward, before the player defeats him in a battle and retrieves the stolen item. Before the player battles Zacian at the Tower Summit in order to catch it, they give the Rusted Sword to it as its held item.
In Pokémon Shield, the Rusted Sword is instead obtained by Hop. During the post-game, when he returns it to the altar at Slumbering Weald, it is stolen by Sordward. Hop battles Sordward, but is defeated, allowing him to get away with the item. Later, Sordward uses the Rusted Sword to lure Zacian to the Tower Summit. After the player has battled Zacian, it flees, and Hop retrieves the Rusted Sword from Sordward, before chasing after Zacian. After Hop has caught Zacian at Slumbering Weald, the Rusted Shield becomes its held item in the player's subsequent battles against him.
The Rusted Sword does not appear as an item in the player's Bag until they've caught Zacian holding it. This is likely done in order to prevent the player from removing the item from their Bag too early and contradicting the events of the game's story.