I'm a DM in a campaign and I was wondering if I could make my own weapons. I would like to create both mundane and magical weapons. Yes, the ones already in the Dungeon Master's Guide are pretty cool, but I'd like to make weapons of my own. Is this illegal?
As DM, you can do whatever you like, but I recommend following the guidance in Chapter 9 of the Dungeon Master's Guide.
The introduction to the Dungeon Master's Guide says (pg. 4):
The Dungeon Master (DM) is the creative force behind a D&D game. The DM creates a world for the other players to explore, and also creates and runs adventures that drive the story. [...]
The D&D rules help you and the other players have a good time, but the rules aren’t in charge. You’re the DM, and you are in charge of the game. [...]
And in the introduction Chapter 9, we see (pg. 263):
As the Dungeon Master, you aren’t limited by the rules in the Player’s Handbook, the guidelines in these rules, or the selection of monsters in the Monster Manual. You can let your imagination run wild. This chapter contains optional rules that you can use to customize your campaign, as well as guidelines on creating your own material, such as monsters and magic items.
In the Chapter 9 section "Creating a Magic Item", we see (pg. 284):
The magic items in chapter 7, "Treasure," section are but a few of the magic treasures that characters can discover during their adventures. If your players are seasoned veterans and you want to surprise them, you can either modify an existing item or come up with something new.
This section contains detailed guidance for designing your own magic items and weapons. I highly recommend following the guidance given in this section, as inexperience with designing magic items often leads to unforeseen, game-breaking consequences.
Finally, I will note that the design principles listed in this guidance apply to mundane weapons as well as magic weapons.
You can add weapons of your own design to the game, but be cautious. The existing weapons cover an enormous amount of design space, so making a new weapon that doesn't completely duplicate an existing weapon puts you in danger of making something that completely overshadows all existing weapons.
To me, there are two basic options: reskin or nudge.
Reskinning means just taking one of the existing weapons and giving it a new name and description.
If you want to add a bec-de-corbin to the game (a polearm with a sort of curved spike, like a pick with a very long handle), you can look at the list and see that all the martial polearms have the reach, heavy, and two-handed qualities, and one of them does piercing damage. So you can just take the pike and say "okay this is a bec-de-corbin now".
If you decide you want to add a japanese nagamaki (a short haft with a heavy sword-like cutting blade), it's easy enough to simply erase "battleaxe" and write in "nagamaki".
No need to design anything; it's merely a name change.
Nudging means taking an existing weapon and making a very small change to its stats to make it represent something different, usually by either changing the damage type (which are generally interchangeable) or adding a minor special rule.
If you want to add the classic chinese rope dart to your game, you might just decide it's a whip that deals piercing damage instead of slashing.
Similarly, a boomerang could be represented as a light hammer, but with an added special rule that if you miss with a throwing attack using it, it returns to your hand at the end of your turn, provided it has ample space to loop around and reach you.
The only thing that's really missing from the D&D list that the prior options won't handle is two-ended weapons like the classic thri-kreen gythka or the old double-bladed sword. However, that's been covered as of the release of the "Eberron: Rising From the Last War" campaign setting for 5e, which features the Double Scimitar: it's an expensive (100 gp) martial weapon that is two-handed and deals 2d4 slashing damage. After an attack action with it, you can use a bonus action to attack with the second blade, dealing 1d4 slashing damage if it hits. (Stat bonus to damage applies to both hits, unlike two-weapon fighting.)
I'd use those stats for any kind of double-bladed slashing weapon, probably with an additional caveat that you need special training to learn to wield it properly. For example, in my Eberron home game, I ruled that elves from Valenar that have proficiency with all martial weapons also have proficiency with the double-bladed scimitar, and anyone else who wants to use one proficiently would have to get training from one of them or put in extensive training time to develop their own style with it.
Yes, the DM can make whatever they would like for their game
There are two ways to do this: you can make your own weapon or you can modify a weapon.
Making a weapon is harder, but you have more control over what you want to come from it weather it be a flaming sword or never miss longbow. Making a weapon allows you to make a weapon however you want to fit your needs.
Modifying a weapon is easier because you already have a format and a general idea, and you just build off of a preexisting item.
Both of these ways are pretty cool but modifying a weapon is easier for a new DM/GM and creating a weapon would lean towards a more experienced DM/GM.
In a normal game, yes, but not in Adventurer's League.
In a normal game, the GM is able to do basically whatever they want, as long as the players agree to it. However, Wizards of the Coast runs the Adventurer's League, an officially-supported shared campaign, and that includes additional rules for its GMs on what they are allowed to do and include in their games to ensure a fair and consistent experience; notably, this includes a complete ban on homebrew of all kinds - and even a ban on content published by Wizards of the Coast, outside of certain specific resources.