A unit of spearmen works together to stab you from a further reach than you can respond with a sword. I think you also overestimate the ease with which you could chop a spear. Designs differed, but a Greek dory was about 2 inches in diameter. Try taking a whack at the wooden shaft of a shovel some time and see if you get it in one go. Remember that in combat if you were doing this, the person with the spear and the rest of the front rank would also be trying to stab you rather than standing still like polite mannequins.
A formation unit purely of sword-using infantry against spears would be pushed as the spears could kill the sword-users, while at best the sword-users could damage some of the spears but wouldn't get close enough to harm any of the spearmen. The spear unit with multiple ranks of usable spears could keep going even if a few spears were damaged.

Some sort of skirmishing formation of sword-users would be in even worse shape, as they'd be overwhelmed by a formation and as light moving skirmishers would likely not have full sized shields so if archers were involved would be easy pickings.
Swords in the Greek ancient world were used for close in fighting once the initial contact between formations had been made or if the quarters were otherwise impractical for spears.




You were originally asking why spears hung on so long as a military weapon. Battles were not one on one duels. To ignore this seems to be fishing for some kind of answer that intentionally ignores the historical context.