This happens to me quite frequently.
For instance, until very recently I didn't realise that people find it offensive/inappropriate when I say I find something easier than they do, or am more academically gifted than other people. My partner took me aside and said they people find this arrogant and don't want to be told this. I really didn't, and still don't, understand why. They tried to explain, for about forty minutes, then gave up. But they said something that I think holds try specifically for us Autistic/Aspie people, you don't have to understand why it offends them just know and accept that it does. No matter how irrational and strange it seems. To them that fact that we don't understand why is just as peculiar.
It's not a full proof plan, but I keep a mental list of things that people are likely to find offensive and then check what I'm saying with it. Then decide if it's still something I want to say.
My list current list (although it's not exhaustive, as people seem to find just about anything offensive) of things likely to offend:
1. Anything that is negative, however true, about a person, their family, close friends, race, culture, religious or sexual persuasion, personal hobbies or interests, etc, basically any personal information imaginable.
2. Comments perceived to be 'insensitive', for example I've pointed out before that it's impractical to give money to charities to feed children in countries that aren't in a position to provide economic security to all the children born there. Money would be better served helping to develop political and economic security first, then feeding. People think you're a monster and cry "But what about the children!?!".
3. Pointing out that something some has said is factually, grammatically or logically inaccurate.
NT Partner says the list covers most things.