Macbeth is confident because of a prophecy that says that a man born of a woman cannot kill him. This is why he has courage to go to battle against Malcolm and Macduff.
However, when Macduff tells him he was born by cesarean section, Macbeth loses his confidence. He realizes he can lose the battle and declines to fight Macduff. In the end, Macduff defeats Macbeth and takes his head to Malcolm.