If the unicorns are intelligent, their horns are tough enough to take multiple sword blows, and their horns are approximately as long or longer than the infantry's effective reach (sword + arm, extended to a length where the weapon is a real threat), then the infantry is toast.
The battle goes like this: unicorns charge in tight formation. For each unicorn, if the infantryman in front of them swings, they block it with their horn and stomp the guy with their hooves. If not, they skewer them with the horn (which, unless shockingly dull, would easily penetrate chainmail). The formation then turns and gallops away. Since unicorns are presumably fast and have considerable endurance (like horses), they can attack any part of the formation that sticks out, where the escape part is easiest. If the infantry is exceedingly good at starting with a tight formation, unicorns could choose to go on a semi-suicide charge to break the formation (was done on occasion with warhorses), after which the following unicorns could attack the vulnerable infantry.
If, on the other hand, the infantry has considerably better reach or can cleave through the unicorn's horns, and also has a numerical advantage, then the infantry has a winning strategy: pack warriors in tight formation so that at least two of them can strike any incoming unicorn. 358
Both aim for the neck, one high and one low. Most of the time, the unicorn may kill one of the soldiers, but the other one will kill the unicorn. (This is why pikemen rendered cavalry almost obsolete except for chasing down fleeing soldiers; any well-organized unit would present a forest of sharp metal points to any incoming cavalry.
Either way, if one side outnumbers the other hugely, the larger army will win; the question is really by how much you need to outnumber the other. If you're going for some sort of heroic fantasy setting, probably ten-to-one men to unicorns would be a tense battle, assuming nerves held on both sides and neither had a big tactical advantage (of the sort described above).
For ideas about how the two sides should try to maximize their chances, you can read about infantry and cavalry battles and tactics. (The Greeks, esp. under <PERSON>, had very effective wedge-shaped formations of cavalry.) 358