Macbeth was in a desperate battle fighting for his life. He would have killed any soldier who confronted him. So, the answer to your question is simple: Young Siward challenged him and was killed. The question should be: Why does Shakespeare show Macbeth fighting and killing Young Siward?" No doubt Shakespeare had several reasons for including this episode in Act 5, Scene 7.
For one thing, Shakespeare intended to have Macduff find Macbeth on the battlefield and kill the tyrant after an exchange of words. Shakespeare apparently wanted to show that Macbeth was valiantly engaged in fighting the enemy despite their overwhelming odds. Also, Shakespeare wanted to show that Macbeth still considered himself invulnerable because he was relying on the promise of the Second Apparition evoked by the witches in Act 4, Scene 1:
Be bloody, bold, and resolute; laugh to scorn
The power of man, for none of woman born
Shall harm Macbeth.
It seems that Macbeth is invulnerable as long as he believes himself to be invulnerable. When he is confronted by Young Siward, he dispatches him quickly and says:
Thou wast born of woman
But swords I smile at, weapons laugh to scorn,
Brandish'd by man that's of a woman born.
Among other things, Shakespeare wanted to show that Macbeth was valiant and that he was almost impossible to beat in a sword fight until he learned that Macduff was not exactly born of woman because was delivered as an infant by a primitive caesarean operation. He was "from his mother's womb untimely ripped." At this point, Macbeth sees he is doomed to defeat.
Accursed be that tongue that tells me so,
For it hath cow'd 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.
It is possible that Macbeth could have defeated Macduff in a duel if he had not lost his nerve when he realized that he was confronted by the man who had the strongest motivation to kill him and, furthermore, that that man was not "of woman born." The assurance Macbeth had received from the Second Apparition became turned against him. If he could not be harmed by any man of woman born, then he could be harmed by a man who was not of woman born.
Macduff forces Macbeth to fight and kills him in their death duel.