I can suggest some words that are close, but not perfect.
intuitively means without reasoning, but it suggests that the action also comes naturally to the person. I think that this is the closest word that means doing something without knowing why.
unwittingly means without knowledge and without deliberation, but it suggests a degree of accidental behaviour as opposed to being deliberate and just not knowing why. Someone who unwittingly took an item from a store without paying for it may have just had it fall into their bag by accident.
I also like unintentionally in both your examples. Especially because "why" is the cause or the intention underlying an action. But it also means that there may be no intention at all, as opposed to just being unaware of what the intention was. And unfortunately unintentionally doesn't capture the nuance of the difference between "he didn't know why he was motivated to offend the person" and "he didn't know why the person was offended by his [deliberate] actions".
Interestingly, I don't think there's an adverb that means "knowing why" in the affirmative case either.