When you make an attack roll (either using a melee weapon, such as a sword, or a ranged weapon, such as a bow, or when you use a spell that tells you to make a melee/ranged spell attack), you take the AC of the creature as the threshold you have to reach or surpass to hit the target.
Example:
You use a longsword to attack a creature. Your strength is 14, i.e. modifier +2, your proficiency bonus is +2, making your attack bonus +4.
Therefore, you now roll a d20, and add 4. Then, you compare this value to the AC of the targeted creature, and if you have scored at least the same value, you hit and can roll for damage.
Example values:
- you rolled a 7+4 = 11, versus an AC of 15. The attack does not hit
- you rolled an 11+4 = 15, versus an AC of 15. The attack does hit
- you rolled anything higher than an 11+5, versus the same AC of 15 → you also hit.
The way AC works is, you basically have armor and your dexterity. So if your AC is higher than the attack, you eigher dodge out of the way, or you deflect it with your armor.
Mind you, there are other kinds fighting your enemies, such as casting spells, which often require saving rolls. In that case, the target has to roll a d20, adding the value of the required saving throw, and score at least the same value as your spell save DC (which is 8 + proficiency modifier + spellcasting modifier). That wasn't your question, though, so for more details, read the spellcasting chapter in the Player's Handbook.
The AC on the pregenerated sheets is calculated by taking the base AC of the worn armor (leather 11, studded 12, etc.) and adding the creatures dexterity value. Heavier types of armor let you add less (medium armor, max +2) or even no dexterity bonus (heavy armor). With light armor, you can add as much dexterity bonus as you want. If you aren't wearing any armor, your AC is simply 10 + your dex. Mind you, negative dex also reduces AC, unless you are wearing heavy armor.
What does AC do?
AC makes it harder to hit the creature. To reduce the damage, you need resistence (1/2 damage) or immunity to the type of damage that the attack deals (slashing, bludgeoning, and piercing for regular weapons, or fire, cold, etc. for other effects). There are also class features (such as the rogue's "Uncanny Dodge") that allow you to reduce the damage regardless of resistence. You can stack such a feature with resistence for 3/4 damage reduction, but gaining resistence from multiple sources doesn't help any more than just from one source.