You must navigate to a forge (the anvil icon on the map) and use shards to craft a legendary weapon. Shards are acquired via disenchanting unwanted weapons, abilities, etc. You are not guranteed to craft a legendary weapon everytime and because you can only craft one weapon at every forge, you may have to travel to multiple forges in one match or use the forge in multiple games.
Ultimately disenchanting and persistence is all you need.