When you say "I didn't have the heart to tell him [insert uncomfortable truth here]", it means that you didn't say it because it would have hurt their feelings in some way. That seems a little bit backwards; in any other context, being sensitive about someone's feelings is having "a big heart" or "too much heart," and being "heartless" is being insensitive and not caring about others. So why does the heart metaphor seem to be backwards in this particular expression?
Another definition of "heart" is courage. So in that expression, someone is saying, in other words, they did not have the courage to tell him (uncomfortable truth).
Definition #4c of heart from MW-O:
4: the emotional or moral as distinguished from the intellectual nature: as
c: courage, ardor ex. never lost heart
From the Online Etymology Dictionary, a timeline of the various uses and phrases including "heart":
Old English heorte "heart (hollow muscular organ that circulates blood); breast, soul, spirit, will, desire; courage; mind, intellect," from Proto-Germanic *herton- (cognates: Old Saxon herta, Old Frisian herte, Old Norse hjarta, Dutch hart, Old High German herza, German Herz, Gothic hairto), from PIE *kerd- (1) "heart" (cognates: Greek kardia, Latin cor, Old Irish cride, Welsh craidd, Hittite kir, Lithuanian širdis, Russian serdce "heart," Breton kreiz "middle," Old Church Slavonic sreda "middle").
Spelling with -ea- is c. 1500, reflecting what then was a long vowel, and the spelling remained when the pronunciation shifted. Most of the modern figurative senses were present in Old English, including "memory" (from the notion of the heart as the seat of all mental faculties, now only in by heart, which is from late 14c.), "seat of inmost feelings; will; seat of emotions, especially love and affection; seat of courage." Meaning "inner part of anything" is from early 14c. In reference to the conventional heart-shape in illustration, late 15c.; heart-shaped is from 1744.
Heart attack attested from 1875; heart disease is from 1864. The card game hearts is so called from 1886. To have one's heart in the right place "mean well" is from 1774. Heart and soul "one's whole being" is from 1650s. To eat (one's own) heart "waste away with grief, resentment, etc." is from 1580s.
The feeling that I get from this phrase is more like
I didn't have the heartlessness to tell him.