King Saul was pursuing David to kill him. But instead David managed to get near the king then he chose to not kill Saul. King David was planning to take over his reign. But since King Saul was anointed by God to rule Israel David respected that and would not kill him.
1 Samuel 24:
16 When David had finished speaking, Saul called back, “Is that really you, my son David?” Then he began to cry. 17 And he said to David, “You are a better man than I am, for you have repaid me good for evil. 18 Yes, you have been amazingly kind to me today, for when the Lord put me in a place where you could have killed me, you didn’t do it. 19 Who else would let his enemy get away when he had him in his power? May the Lord reward you well for the kindness you have shown me today. 20 And now I realize that you are surely going to be king, and that the kingdom of Israel will flourish under your rule. 21 Now swear to me by the Lord that when that happens you will not kill my family and destroy my line of descendants!”
22 So David promised this to Saul with an oath. Then Saul went home, but David and his men went back to their stronghold.