There are some misconceptions that need to be dealt with.
First off, which knight from which era?
Late MA & early Renaissance
Mid-MA
Early MA / Late antiquity / Dark Ages
(I am only going to cover the best armors from each era. There were plenty others.)
Late / High MA & Early Ren
Late middle ages & early renaissance had the best danged armor vs muscle-powered weapons seen in the history of mankind. It was so danged good that later jousting armor did away with the shield and just thickened up the shield-side a bit. The jousting armor was pretty heavy and specialized.
The field plate armor, though, was a wondrous thing. It likley massed less than the best/heaviest armors that preceded it. It was custom-made for the knight and less restrictive than those earlier armors. Contrary to popular belief, many battles were fought with the knightly class dismounted on purpose, as it made sense in some circumstances to have the heaviest of heavy infantry rather than heavy cavalry...especially since even heavy cavalry is no match against well-trained and disciplined infantry that does not lose heart (more on that later).
The pinnacle of plate armor development was similar to the pinnacle of automotive development:
* Better protection
* Lighter
* More mobile
* Near-ideal weight-distro
Mid MA
The best armors were usually chain mail and then chain with some plate armor. Sometimes brigandine under plate. Not a unified plate system as came later, but more piecemeal with plates covering what is easiest to cover with plates:
* breast plate
* back
* some arm & leg bits
All the joints & tough-to-cover bits were covered in mail or brigandine
Much less integrated than the later plates. Very much a transitional phase (between mail and plate). Most likely the totality was heavier, less-balanced, and less protectives than the plates that followed.
Early MA back to Late Antiquity (Dark Ages)
Charlemagne instituted arms control. He did not want either the compound, recurved bow or chain mail to be exported from his realm, as their technological superiority gave him an advantage.
Chain mail / lorica hamata dates back to the Roman Republic and its use waxed & waned over time until it slowly replaced the (superior to mail) "banded" / lorica segmata and scale / lrica squamata.
Carolingian heavy/med-heavy cavalry was truly formidable, as it was relatively heavily armored (mail), had the stirrup, lance, & long/broad sword, as well as the compound recurved bow. The knightly clas, though, started off as heavy infantry before the battle of Tours and learned a trick or two after they beat back the Moors.
Byzantium & Points East
These guys never went whole-hog into the plate and heavier armors. They had some well-made heavier armors, but they were less protective and a bit more flexible during most the MAs relative to the West. The Byzantines held on to splint/lorica squamata for a lot longer than the West.
Infantry vs Cavalry
With muscle-powered or black-powder-powered arms, the advantage lies with the infantry. The more trained and more disciplined the infantry, the less likely cavalry is going to overrun them.
Most middle-ages infantry was, to be blunt, *expletive deleted*it. Usually levies called up with little/no training and very poorly armed. There just was no money to keep an infantry army trained and equipped. It was against just this sort of infantry that the knightly heavy cavalry made its name. As soon as the economy/polity got to the point where it could support well-trained & equipped infantry, the cavalry charge was neutered.
Examples of this are seen in 16th century Italy & later 17th century north with the warring (but prosperous) city-states. The cavalry was reduced the caracole (1) in the face of the infantry tercio(2), which could withstand a cavalry charge as long as numbers weren't too out of whack or the infantry lost its morale.
The calculus usually went thus:
1. In the space one cavalryman needed to operate, there are several infantrymen. Muscle-power or black-powder, the cavalryman is going to have several spear-heads or round balls seeking his vitals.
2. Warhorses are serious critters, heavy, and can do some damage. But, horses are also the most delicate beasts of burden and the most vulnerable bit of the knight's equipage.
3. If the infantry had time to prepare the battlefield (fieldworks: spikes, trenches, etc.) the infantry could funnel the cavalry or blunt their charge before it got to the infantry. Which is why many times, the knights went afoot, as they knew they'd be useless in a cavalry charge. They were then the best infantry on the field.
Regarding the OP: Legionnaire vs Knight
Any all-infantry matchup I would give toe the legionnaires, not contest. Rome produced the best infantry on the face of the Earth over the longest time. Unless the legion picked was an outlier, they will have been trained, equipped, and blooded. Most importantly, they had discipline and worked as a unit their entire military career.
One-on-one, knight vs legionnaire, likley would go to the knight, though. The knight was upper class, usually better fed during development and likely larger than the average leginnaire. Also, he was born to fight, not just well-trained. Last, the later knights would have a material advantage, given plate armor.
If it was knightly cavalry vs legion, I would still likely give the advantage to the legion. It is not as if Rome never fought (& defeated) cavalry. They did so all the way to the Tigris & Euphrates and never went whole-hog for cavalry.
The late MA knight did have a few advantages relative to that other cavalry. The stirrup & lance combo as well as improvements in material equipage were significant improvements over ancient cavalry.
I still think the drill & discipline of th legion would win out over the material advantages of the knight, however.
I think the most difficult of hte knightly types for a legion to handle would NOT be the later, highest-technology knight. I think it would be the early Carolingian knight inthe era between Charles the Hammer and Charles the Great. They knew heavy infantry tactics & discipline, had the stirrup & lance, and also had the compound recurved bow. I think they would give hte legion a run for its money.
(1) Charge massed infantry, discharge horse pistols, hope infantry scatters. If they remain unimpressed with the minor nobleman's pretty horsey & noisy entrance and don't scatter, the cavalry turns about and reloads. This develops into a wheel-like formation where the cavalry shoots, turns about, reloads on horseback, and then takes another charge. Works OK as harassment unless the infantry pikemen are backed by arquebus-armed infantry.
(2) Think "combined arms pike square." Some tote long spears, some had swords, some had arquebuses. All drilled to move as one unit