That's an issue with anglo-centric western canon. Basically it's because of Arthurian Romances but swords evolved to represent masculine power in literary tradition. There are other weapons in other literary canons, Greek heroes use spears, Turks use maces, Thor uses a hammer, samurai use bows and naginatas, etc.
Most of the medieval popular culture stuff is inspired by Tolkien, who is British and inspired by Arthurian romance. Medieval rpg's we play are there thanks to Tolkien, and that's why they mostly use swords.
Also swords often symbolise penis, you can see it in 18-19th century literature clearly.