That’s just the half of it…
If you dig into the Jewish traditions— and they are very big on their hero-King David-- David’s mother was Nitzevet, the daughter of Adael and the wife of Jesse. The Talmud relates a rather complicated story concerning Nitzevet: her husband, Jesse, doubting the purity of his ancestry, since he was the grandson of Ruth the Moabitess (Ruth 4:17) decided to sleep with a Cannanite maidservant and intended to marry her.
The maidservant, however, had pity on Nitzevet and offered Nitzevet a plan: on the wedding night, Nitzevet and the maidservant could secretly switch places, and Nitzevet could sleep with Jesse one more time. The switch worked, much as Leah and Rachel’s switch had worked on Jacob, and Nitzevet became pregnant with David, her eighth son.
Nitzevet never revealed to Jesse what she had done, even when her pregnancy was apparent; therefore, Nitzevet came to be despised and thought of as an immoral woman who had slept with someone else, and her son, David, grew up an outcast in his own family.
This is an extrabiblical legend, and there is no way to confirm the accuracy of the tale of Nitzevet.
However… it at least offers an attempt to explain why David was not accepted by his family: “I am a foreigner to my own family, a stranger to my own mother’s children” (Psalm 69:8).
David was left to tend the flocks when the prophet Samuel invited all of Jesse’s sons to a sacrifice (1 Samuel 16:5).
God had told Samuel that He would choose one of the sons to be anointed king, but the family never even considered David as a possibility (1 Samuel 16:11).
The theories might also shed some light on Psalm 51:5
“Behold, I was brought forth in iniquity, and in sin did my mother conceive me”