In both Dragon Ball Z and Dragon Ball Super, Future Trunks carries a powerful sword that has aided him in some of his biggest battles. Despite it being his greatest asset, the sword is barely discussed by the characters, and neither anime ever attempts to explain how he got the sword. The answer is instead found in one the movies, Dragon Ball Z: Wrath of the Dragon, which has yet to be made official canon.
Two versions of Vegeta's son, Trunks, exists in the world of Dragon Ball. One is a troublesome child, and the other is an adult from a post-apocalyptic future. Dubbed "Future Trunks", he is a much older and serious version of the character who wields a sword. In Future Trunks' timeline, the Z-Warriors are all dead, forcing Trunks to be the Earth's only hero. He debuted in the Android Saga of Dragon Ball Z, prior to the birth of his younger self. He left the series after the Cell Saga, and didn't come back until the fourth arc of Dragon Ball Super, the Future Trunks Saga, where he got Goku and Vegeta involved in a battle with his timeline's latest threat, Goku Black.
In his battles with Frieza, Goku Black, and Zamasu, Future Trunks' greatest weapon is his sword. But where exactly did this weapon that holds so much importance to Trunks come from? The movie, Dragon Ball Z: Wrath of the Dragon explains the sword's origins. Wrath of the Dragon takes place after the Buu Saga, so at this point the Z-Warriors have already met Future Trunks, and the young Trunks is at least eight years old. During the events of the movie, the Z-Warriors encounter Tapion, a warrior caught in a long-standing struggle with a monster called Hirudegarn. Tapion possesses a sword that looks curiously like the one carried by Trunks' future counterpart.
Over the course of the movie, Tapion and Trunks develop a bond, and after Hirudegarn's defeat, Tapion gives the sword to Trunks. According to Tapion, he thinks the sword somehow always belonged to Trunks, which hints at it being the same weapon that first appeared in the Android Saga. If there's any doubt left by Tapion's remarks, the credits confirms that the two swords are the same by showing Future Trunks wielding it.
What's interesting is that the two Trunks' timelines diverged long ago, so it's surprising that the young Trunks has somehow experienced one of the same adventures things that the future version apparently went through. Regardless, Wrath of the Dragon suggests that despite the different circumstances, Future Trunks still befriended Tapion at some point in his life. It remains to be seen if Trunks' friendship with Tapion and the origin of his sword will ever be addressed in-canon, or if a later installment in the anime will give the story a different take on the sword's origin.