Most of us, at one point or another, have pointed to 1 Samuel 13:14 and Acts 13:22 zealously declaring we should be men after God's own heart just like David! This is a mistake. When we say that, we mean that David is a man who seeks after God's heart. But do you see the word "seek" in either of those passages? It's not there and here's why. King David being designated by God as a man after His heart is about God choosing David, not David's character. The phrase "after my own heart" was commonly employed by other ancient near easterners.* It simply means, "this is the person I've chosen." When a god or king chose someone to rule, he would describe the successor as a man after his heart. When God utilized this phrase to describe David, He was not commenting on David's stellar character (which was anything but stellar), He was alerting the audience that David was the chosen ruler of His people. This is contrasted with Saul who was appointed king as a judgment on Israel for their rejection of God's kingship and their sinful request for a king like all of the other nations (see 1 Samuel 8:1-9).
A Lesson from This Phrase
David's installment and perseverance as Israel's king was a result of divine election and promise-keeping (cf. Psalm 78:70, 1 Kings 8:16), not the result of any particular merit he possessed. God is the one with the wisdom and authority to designate this son of Jesse as the "man after his own heart." When David commits his egregious sins, he is kept in office because God picked him. This points us to one of the most notable features of the Old Testament narrative: the major figures are incredible sinners. And yet, they remain God's instruments in advancing the redemptive story because He ordained their part in it. In like manner, we who are chosen by God have confidence in His promise to keep us as His own. God has "predestined us for adoption" (Eph. 1:5) and we have complete assurance that no sin can take God's favor from us. All former, present, and future transgressions have been paid for by Christ and we can confidently enjoy God's abounding love. The point is that our character does not determine whether or not we are men and women "after God's own heart." God has already picked us. Rather, knowing that God chooses us despite our glaring deficiencies is precisely what shapes our character.
The Anticipated "Man After God's Own Heart"
The selection of David as a king "after God's own heart" is not an end in and of itself, but rather serves as a foreshadow. When God promises in Jeremiah 33:17 that David's throne "shall never lack a man" He is pointing us to a much greater figure than King David. Isaiah 9:7 describes the Messiah as one who would assume the "throne of David." Then, in Luke 1:32, the angel Gabriel explicitly tells a trembling, frightened Mary that "the Lord God will give to [Jesus] the throne of his father David." Christ is the eternal King from David's line. He will be called King of Kings and His kingdom shall know no end. He is the King that God has chosen to rule and reign forever. Jesus is the longed for "man after God's own heart", the royal Son of the Almighty, who gave His life to transform rebellious subjects into sons and heirs. ---------- *For example, see this excerpt from Henri Frankfort's book Kingship and the Gods – a study of Ancient Near Eastern Religion as the Integration of Society and Nature. Scroll half way down the page, look for the heading THE CHOICE OF THE GODS and examine the end of the last paragraph. You will see Cyrus the Persian describing the god, Marduk, as searching for "a king after his own heart."