In 1 Samuel 21, David is fleeing for his life. He doesn’t want Saul to know where he is. He comes to a priest who is trembling to talk to him. It would seem the priest does know that something is wrong; otherwise, why would he tremble before David? Though, it would seem we must assume he didn’t know about Saul’s desire to kill David. David was popular in the kingdom. I do understand if Saul’s desire was kept close to home.
The priest helps David out by giving him the sword of Goliath, which the priest knows David had gotten in the first place. He also gives David the Bread of the Presence. It was unlawful for David to have it. It was for the priests. The bread was a symbol of God with His people and His people living before Him.
The priest hands it over. Jesus points out this story to point at the hypocrisy of the Pharisees. In Mark 2 and Matthew 12, we can read about the Pharisees being upset at Jesus’ disciples plucking heads of grain on the Sabbath. That is a lawful act under the law of Moses; it only broke the rabbinical laws they had been developing and burdening people with.
The Pharisees saw David as a hero of their faith and first ruler in the line of rulers leading to their Messiah. They were upset at the disciples, but not at David who technically had the worse sin.
Jesus points out that God desires mercy, not sacrifice and that the Sabbath was made for man, not man for the Sabbath.
David survived by the mercy of God. His heart was for God, even if his actions sometimes missed the mark. He knew the love of God which said that David was more important than the Sabbath law.
It’s like how Jesus points to the Pharisees’ hypocrisy in a future encounter pointing out how any of them would rescue their donkey on the Sabbath, so why wouldn’t you rescue a man?
David knew God’s love for him, and God knew David’s love for Him. It was a love covenant, a forever love covenant.
David takes matters into his own hands, trying to save himself by acting like a madman. God shows mercy. Love covers a multitude of sins.