Shakespeare's Macbeth is a tragedy in which one man rises to a high position then falls, a series of events some blame either on the witches or fate. The scene to which your question refers is a picture of how even a villainous traitor can die with dignity.
The former Thane of Cawdor has been discovered as a traitor, and he has been sentenced to die, of course. The report of his demise has been delivered to the king, and it's clear the traitor was more honorable at the end than at the peak of his life:
...very frankly he confess'd his treasons,
Implored your highness' pardon and set forth
A deep repentance: nothing in his life
Became him like the leaving it; he died
As one that had been studied in his death
To throw away the dearest thing he owed,
As 'twere a careless trifle.
This incident, appearing so early in the play and directly prior to Macbeth's entrance, serves as a both a foil (contrast) and a foreshadowing of Macbeth's death at the end of the play. The traitor understood his wrongs and repented, knowing he deserved his fate; in contrast, Macbeth understands he deserves his fate, but he dies fighting.