This phrase is one of the easiest phrases to trace back as it hails directly from the Bible. Among other places, it can be found in Samuel 13:14:
“But now thy kingdom shall not continue: the LORD hath sought him a man after his own heart, and the LORD hath commanded him to be captain over his people, because thou hast not kept that which the LORD commanded thee.”
And it is found in Acts 13:22:
“And when he had removed him, he raised up unto them David to be their king; to whom also he gave testimony, and said, I have found David the son of Jesse, a man after mine own heart, which shall fulfil all my will.”