Duncan is a divinely appointed king. He became king through his lineage, his bloodline, descending to the throne. He is a much loved king. Macduff refers to him after he is murdered as:
"The Lord's anointed temple, and stole thence
The life o' the building!" (Act II, Scene III)
Macbeth becomes king through murder. He is not divinely appointed by God through succession of his birth like Duncan. As Macbeth assumes the throne, he becomes consumed with holding onto his power. He does not care about his subjects, only power.
Duncan appoints his son, Malcolm as his successor, Macbeth is ready and willing to murder anyone who threatens his throne. He has no children, but can't imagine not being king.
Duncan is a noble king, recognizing his authority, and revered by his subjects. Shakespeare shows how much Duncan is loved when all of Scotland is in disarray when he is murdered.
When Macbeth is murdered, on the other hand, everyone is relieved. Macbeth was a tyrant as king, Duncan was a kind and wise king.
One is legitimate - Duncan. The other is illegitimate - Macbeth.