What is this unit for?Edit
What exactly is it meant to counter? Swordsmen and archers?
Generally, the Trooper in AoCH fulfills the same role as the basic knight in AoE2. Many players predominantly use this unit to rush. It's the first armoured cavalry unit most civs get - and for some civs or with certain Policy Decisions it's the only armoured unit a civ gets at all.
It's a decent counter to early militia and small bands of archers, hence Trooper rushs are commonly seen. Statistically they're outclassed by knights from the castle, especially in later centuries, when crossbowmen can pierce through nearly everything without decent armour or enough speed to close the gap. However, the fact that you can train them from the Stable makes it easier to train/mass them.
However, there are certain civs with Trooper bonuses and Trooper-boosting technologies, that can make them become better than the respective knightly units.
Vice versa, there are civs like Scotland where they are even weaker than light cavalry and would only find some early use because of their better armour (unfortunately, if you take Scotland, Troopers are also more expensive, hence not really a recommended unit to use).