Malcolm's confidence is based on the fact that he is the legitimate heir to the Scottish throne as the eldest son of Duncan. Furthermore, he gradually acquires the support of the English king and of the Scottish nobles who are fleeing from Scotland, notably the influential Macduff, Thane of Fife. Macbeth is being deserted because he has become a tyrant as well as an incompetent ruler.
Macbeth's confidence is based largely on a belief in the supernatural. The three Weird Sisters have predicted accurately that he would become Thane of Cawdor and that he would become king. He has become convinced that they and their masters can foretell the future, and they seem to have assured him that he is invulnerable because he cannot be overthrown unless Birnam Wood can move to Dunsinane and also that he cannot be defeated by any man "born of woman." He believes both things are impossible and that therefore he is unassailable. His confidence is shaken when he is told that Birnam Wood appears to be moving. Then when Macduff tells him he was "from his mother's womb untimely ripped" he loses all confidence and says:
Accursed be that tongue that tells me so,
For it hath cowed my better part of man!
And be these juggling fiends no more believed
That palter with us in a double sense,
That keep the word of promise to our ear
And break it to our hope. I'll not fight with thee.
Act 5, Scene 8