https://neurolaunch.com/autism-and-lying/ explains it really well.
Telling a white lie, “No, your haircut looks great!”, requires rapidly modeling the other person’s emotional state, predicting how the truth would land, and generating a plausible alternative in real time. That chain of operations is precisely what theory of mind supports. When it runs slower or less automatically, the white lie either doesn’t happen or comes out wrong.
Add to that being taught when small that lying is wrong and having difficulty with auditory processing of words, and the process goes:
A: What do you think of my hair?
Me, outwardly: [freezes for several seconds]
Me, inwardly: [A said something, I didn't understand it, replay it, A has asked for my opinion of her hair, automatically start to analyse A's hair, decide I don't like it, realise (if I'm having a "good day") that that response won't land well, weigh up the moral value of lying versus not lying in that circumstance, try to formulate a lie, try to figure out a delivery that looks sincere]
A, based on my silence and terrified frozen expression: "You don't like it, do you?"
By this point, nothing I can say will convince A otherwise. The delay alone told the truth.
I get branded "rude" for this, when it's A who's being rude by treating me like her personal cheer squad without my consent. I have no idea why it's socially acceptable to treat people like dopamine vending machines, which is what you do when you fish for compliments, but I wish you'd all stop.