You probably don't want to be standing between 2 people swinging swords on a battlefield. A spear (or polearm) is a better choice for massed infantry. The extra range of the spear is also useful. Spears are also much quicker, easier and cheaper to make than swords.
Some of the allure of swords perhaps comes from the fact that they are the shape of a Christian cross.