Lets break this down even more just to be clear. Here is an example:
Goblin has 7 Hit Points, 15 AC. Character swings a short sword. Short sword has the finesse property, so the character can choose between Strength or Dexterity. Let's say they choose strength and a +1 STR MOD.
Character rolls for attack -- rolls D20 to hit against the Goblin's Armor Class and succeeds with a roll of 14 + 1 STR MOD + 2 PROFICIENCY BONUS = 17 to hit (which is >= 15).
Character rolls damage for short sword rolls a D6 and gets 3 + 1 STR MOD = 4 damage.
Goblin calculates remaining HP. 7 - 4 = 3 HP left for the Goblin.
The goblin flees. Finds a place to take a short rest of 1 hour (or more) and chooses to roll its hit dice to heal some of that damage...