One example of an attack:
Let's say I'm trying to attack a target that has an Armor Class of 18.
I roll my D20 and get a 14. However, because of the weapon I'm holding and some other atributes of my character, I have an attack bonus of 5 which means I add that number to the 14 that I rolled.
That gives my attack roll a total of 19, which is greater than my target's AC of 18. That means my attack was succesfull and now I get to roll the damage my attack will deal!