This concept is not new to D&D or to any other TTRPG and I did not create it - I'm just here to sing its praises. I'm not an internet historian so I have no idea when the concept first gained traction, but I'm guessing possibly that it is a convention learned from video games, though I could be mistaken. Either way, I am going to try to make the case for you to at least try to run or play a game in which their primary magic weapons or items level up with your characters and I'll also go into why it can be fun, what challenges it presents, and how to go about it without breaking the game. Let's dive in!
STEP ONE: REASON AND RHYME TO THE MADNESS
First thing's first - you've got to figure out a good reason for using a weapon-leveling system. I mean, you can just arbitrarily do it and that's completely fine if it works for you and your players are down for it, but in my experience as a DM, it helps to have some sort of underlying reason for it, even if your players don't know that reason. It helps to guide all your future decisions in the game about the nature of the leveled weapons and so forth. Why exactly do they level up with your characters? Where did the weapons come from? How were they made? Who owned them previously, if anyone? Is anyone looking for them? Are there any side-effects from using the magic? These basic questions, among others, should all be answered before you play your first session. For example, using the most recent campaign in which I've used this mechanic, each of my players' characters started off as level 0 orphaned children. It's an experimental thing I'm doing where we're also following the Hero's Journey Monomyth set forth by Joseph Campbell. However, to go in line with the Hero's Journey, I wanted the players to gain some aid in going up against the villains of the story, so they were ultimately presented with magic weapons and told they were a secret legacy left behind by their (murdered) famous adventurer parents. Knowing this and knowing what I wanted to use the weapons for and how I wanted to use them enabled me to make a lot of decisions about them that would aid me in creating the parameters of the magic surrounding the blades.
STEP TWO: BE AS UNIQUE AS POSSIBLE
If you're going to go with a magic weapon that levels with your character, it should be more than a generic longsword or a hunting bow. Think of all the famous fictional characters who possess iconic weapons and model your magic weapons or items with that sort of iconic feel to them in mind. The players should want to take pride as their characters in possessing such coveted items that are a part of their character development in sessions to come. To achieve this, I created magic items that were suited to the characters and their parents in terms of functionality. For example, the rogue of our party had a father who was a pirate and so his scimitar had a scorpion-shaped handle and pommel and I tried to evoke the feeling of an exotic weapon you'd see a character wielding on the high seas. For our wizard, his mother once possessed a magic dagger that would magically return to the hand (thanks, Vox Machina for the idea!), while the bard's father was a fighter and leader and as such the longsword had a lion's head for a pommel and the blade could eventually ignite in flames. I tried to be as unique as possible so to further set them apart, I made the swords with Red Steel (stolen from a D&D supplement from the 1990's but got rid of the curse aspect and put my own spin on it).
STEP THREE: DECIDE ON WHAT LEVELING SYSTEM YOU'LL BE USING
Seeing as I am using the Hero's Journey Monomyth Structure for my campaign, I wanted to use the milestone leveling system because to me, it made the most sense for a magic weapon leveling system although you can make it work with any system you choose. For me, I've worked it into the story that whenever they're about to level up, the swords begin to hum and vibrate stronger and stronger with each level-up. I explained this by having the characters trapped in another dimension which imbues the red steel with strange magical properties. Again, this decision came easy to me because of the first steps I've mentioned. Just be consistent.
STEP FOUR: DON'T BREAK THE GAME!
I tried to balance the magical properties of the magical weapons. They can definitely seem quite strong at times, but the characters have still come very close to death just because they started at level 0 and have had to endure some very dangerous events. The weapons were meant to keep them alive until they got much stronger, and they've done a good job of that so far. For example, at levels 1-4 the swords are only +1 weapons. At levels 5-9 they become +2. At level 10 they reach their final forms - +3. However, I also gave each weapon unique abilities that don't do much to break the game but make each weapon feel special. For example, my bard player has the sword with the lion head pommel and as secondary functions at levels 1-4 the blade was able to emit moonlight that could reveal invisible enemies or bright light that would allow the players to see in darkness. At levels 5-9 the blade is able to ignite and deal extra damage, while at level 10 the player's charisma will extend to 20. Another player, a monk, has a falchion and that sword allows him to walk vertically on surfaces at levels 5-9 while at level 1 it surrounded him with basically a sort of weather control field wherein he was always experiencing a hot or cold breeze to regulate his body temp. I tried to make the secondary abilities somewhat useful but mostly just "fun" narratively. After all, what better image than the party leader becoming a shining, flaming beacon on the battlefield? Or the mage shapeshifting into the person he'd just killed with his magic dagger? Or the monk running along the ceiling? Or even the pirate rogue disappearing in a billowing black cloud of smoke erupting from his scimitar's crossguard? The possibilities are only limited by your imagination.
STEP FIVE: LET YOUR PLAYERS HAVE A HAND IN MAKING THE ITEMS IF POSSIBLE
The main thing is for your players to have fun, so if possible unless you don't want to ruin the surprise (in my game the powers of the weapons are secret and uncovered over time) then let them develop the magical weapons with you, at least as far as how the weapons look and what type of weapon it is. Same goes for general magic items that are supposed to level up with your characters.
That's about all the useful advice I have on that matter. Hopefully you can try it out and let us know how it goes or tell us how it went if you've already done it. As always, thank you for reading! -Joe