In a fight there is a percentage which dictates whether or not you land a hit on your opponent. That percentage is calculated from your attack bonuses versus the opponent's defensive bonuses. So getting a magic weapon with a +1 attack bonus will help your chances of hitting, while wearing better armor will reduce chances of being hit.
Once a hit occurs, another dice is rolled to determine hit points of damage. This number firstly depends upon the type of weapon, and then can be augmented by other bonuses or magical effects such as dipping the weapon in fire before the hit.
Baldur's 3 goes way beyond standard D&D however, by adding all kinds of other factors such as being wet while enraged because your boots of tap dancing are making too much noise for you to sneak up behind a shivering kobold who has just been encrusted by frost. Thank goodness for computers, because otherwise I would never play D&D that way.