Actually, in Shakespeare's Macbeth, Macbeth is Duncan's cousin.
After the witches deliver their prophecies, Macbeth immediately becomes the Thane of Cawdor, a title given to him because of his valor on the battlefield. Cawdor the traitor, stripped of title and lands, is executed, and Duncan gives all that Cawdor had to Macbeth. This is proof (as Macbeth sees it) that the witches have spoken the truth, and it gives Macbeth—and his wife—a lot to think about in terms of his eventual place as the King of Scotland.
There are a couple things that are in his way to climbing to the throne. When Duncan names his son Malcolm Prince of Cumberland, he is naming his successor to the throne.
We will establish our estate upon
Our eldest, Malcolm, whom we name hereafter
The Prince of Cumberland (I.iv.43-45)
Macbeth realizes that he will have to go over—or through—this obstacle if he wants to be king.
[Aside.] The Prince of Cumberland! That is a step
On which I must fall down, or else o'erleap,
For in my way it lies. (55-57)
But Macbeth also argues with himself before taking Duncan's life, giving the reasons as to why he really should not kill Duncan. Duncan is his King, his friend and his guest: the law of hospitality required that even an enemy under one's roof was afforded safety because of this unwritten code. One of the other reasons to stay his hand is their blood relationship: Duncan is his "cousin"—Duncan refers to Macbeth as cousin in Act One, scene four:
O worthiest cousin! (17)
This may be literal (i.e., he may be a cousin), or may be a general reference simply to their "kinship."
He's here in double trust:
First, as I am his kinsman and his subject,
Strong both against the deed; then, as his host,
Who should against his murderer shut the door,
Not bear the knife myself. (I.vii.12-16).
Macbeth says that Duncan has also honored him "of late" and will continue to do so, but his wife wants to be queen. He admits that the only thing really pushing him to murder is his "vaulting ambition" (I.vii.25-28), his desire to be King of Scotland.
So he and Lady Macbeth carry out the murder of Duncan. Now Malcolm and Donalbain do not know now whom they can trust, for they believed (we can infer) that they could trust everyone present...until Duncan is murdered. And even though the King's guards are blamed for the death, it is seemingly apparent that if they killed Duncan, it was not for themselves, but in league with one of the King's close subjects. Macbeth kills the guards (in alleged righteous anger—because he says he was so shattered by Duncan's death that he lost his head), so they cannot defend themselves. In light of all that has happened, Malcolm and Donalbain are convinced that it is better to flee in separate directions, especially if someone is trying to wipe out their entire line, to remain safe. (Macbeth uses their desire for self-preservation as a way to blame them for Duncan's death.) Their absence is something that Macbeth had not counted on, but it works in his favor, and he is crowned king, we can assume as the "next of kin."
While there is not much discussion of the nature of Macbeth's relationship with Duncan, it does seem that he is a direct kinsman, most likely a cousin, of the king. When he hears, for example, the Sergeant's account of the battle in which Macbeth killed the rebel Macdonwald, Duncan exclaims, "O valiant cousin!" Later, in Act I, Scene 4, Duncan greets him by calling him his cousin, and later refers to him as a "peerless kinsman." Later, in agonizing over whether to murder Duncan, Macbeth himself cites the fact that the king is his kinsman as a reason that is "strong...against the deed." Though again, the matter is not discussed at length, the fact that the king's sons fled in the wake of the murder made Macbeth the next in line for the throne, since he is Duncan's cousin. Once Macduff tells Ross, in Act II, Scene 4, that Malcolm and Donalbain have fled the country, Ross replies that "'tis most like the sovereignty will fall upon Macbeth."