When you check the Skills a hero has, the first one of the four small squares will say what troops that hero attacks. In general, siege engines attack the front except flying, infantry attack the front, cavalry attack the rear, and flying attack randomly. Some heroes like Paladin and Captain Pandario have a bias that will make them attack a certain troop type more, so these are good to fill in as a situational case.
There's no hard counter of one role against another, but rather specific heroes can counter different unit types. Take Feroslaught and Captain Pandario. Both are Infantry, but Captain Pandario is great against Cavalry and Feroslaught is great against Flying.
The best way to go about it is to learn the unit type of each hero and learn their icon, so that way when you look at the troop list in, say, Mirage Trials, you won't have to exit to check the types. Keeping a core of 3-4 heroes is good, leaving the last spot to be filled by a hero that'll help against the enemy more based on their composition.
Look for me on Kingdoms World #5! Scrotulus - Current Might: 12,244,658
Hero collection: 29/34, missing only orange heroes
Join (BLD), we are an active and prominent force that is shooting for the top!