In act 1, scene 6 of Shakespeare's Macbeth, King Duncan arrives at Macbeth's castle. In act 1, scene 4, when Duncan tells Macbeth that he's going to visit him at his castle, Duncan gives Macbeth no specific reason for doing so.
DUNCAN. From hence to Inverness,
And bind us further to you. (1.4.48-49)
Shakespeare's reason for doing so is perfectly clear. Duncan is now under Macbeth's roof, and this provides an opportunity for Macbeth to murder him and claim the throne of Scotland, as Macbeth and Lady Macbeth decided to do in act 1, scene 5.
In act 1, scene 7, Macbeth begins his soliloquy with every intention of killing Duncan, which he thinks he should do as soon as possible.
MACBETH. If it were done when ’tis done, then ’twere well
It were done quickly. (1.7.1-2)
Those words are barely out of Macbeth's mouth before he starts to reconsider his decision to kill Duncan. Macbeth begins to doubt that killing Duncan would necessarily give him everything he wants and considers that it might even cause more significant problems.
MACBETH. If the assassination
Could trammel up the consequence, and catch,
With his surcease, success; that but this blow
Might be the be-all and the end-all here,
But here, upon this bank and shoal of time,
We'd jump the life to come. (1.7.3-7)
If Macbeth could be assured that there would be no serious consequences of his actions, he wouldn't hesitate to go through with his plan to kill Duncan. Macbeth is concerned, however, that by killing Duncan, he might be encouraging others to think about taking the throne from him, putting his own life in jeopardy.
MACBETH. But in these cases
We still have judgement here, that we but teach
Bloody instructions, which being taught return
To plague the inventor. This even-handed justice
Commends the ingredients of our poison'd chalice
To our own lips. (1.7.7-12)
Macbeth starts to think of other reasons why he shouldn't kill Duncan.
MACBETH. 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. (1.7.12-16)
If Macbeth is an honorable man, which he considers himself to be (at least until he decides to kill Duncan), Macbeth wouldn't kill a "kinsman"—Macbeth and Duncan are cousins—and he wouldn't kill his own king.
Not only that, but Macbeth should protect Duncan from harm, not kill him himself.
MACBETH. Besides, this Duncan
Hath borne his faculties so meek, hath been
So clear in his great office, that his virtues
Will plead like angels trumpet-tongued against
The deep damnation of his taking-off,
And pity, like a naked new-born babe,
Striding the blast, or heaven's cherubin horsed
Upon the sightless couriers of the air,
Shall blow the horrid deed in every eye,
That tears shall drown the wind. (1.716-25)
These lines are somewhat reminiscent of Hamlet's reasoning in the scene when Claudius is kneeling in prayer and Hamlet has a perfect opportunity to kill him and avenge Claudius's murder of Hamlet's father (Hamlet, 3.3.76-98). Hamlet hesitates because he doesn't want to kill Claudius while he's praying and thereby send Claudius's soul to heaven.
Here, Macbeth has a perfect opportunity to kill Duncan, but he hesitates because he knows that Duncan is a good man and that Duncan has been a good king who doesn't deserve to be murdered. Macbeth fears that there will be a considerable outcry against him if he murders Duncan.
MACBETH. I have no spur
To prick the sides of my intent, but only
Vaulting ambition, which o'erleaps itself
And falls on the other— (1.7.25-28)
Macbeth realizes that he has no reason for killing Duncan other than his own all-consuming ambition. Macbeth is also concerned that he might fail, either in killing Duncan or in taking the throne, and wonders if it is foolish even to try.
Lady Macbeth interrupts Macbeth's train of thought, but while they're arguing about Macbeth deciding that "[they] will proceed no further in this business" (1.7.34), Macbeth thinks of another reason for either delaying or abandoning their plan to murder Duncan.
MACBETH. He hath honor'd me of late, and I have bought
Golden opinions from all sorts of people,
Which would be worn now in their newest gloss,
Not cast aside so soon. (1.7.35-38)
Macbeth doesn't want to compromise the honors he's received from Duncan—being declared Thane of Cawdor, for example—and he doesn't want to lose the high praise or squander the good will of the Scottish people that he's risked his life to achieve.