adverb
absentmindedly; in spite of oneself; as if not oneself
Describes acting without conscious control, as if one's actions are not one's own. Often used when one is surprised by one's own behavior or when acting on impulse. The phrase is somewhat literary and fixed in form.
我にもあらず、彼女に声をかけてしまった。
I found myself speaking to her, almost in spite of myself.
彼は我にもあらず立ち上がり、拍手を送った。
He stood up and applauded, as if not himself.
思わず is a common adverb meaning 'unintentionally' or 'without thinking', used in everyday speech. 我にもあらず is more literary and emphasizes a loss of self-control or acting out of character.
つい means 'carelessly' or 'without thinking' and is very casual. 我にもあらず carries a stronger nuance of being beside oneself or acting against one's will.
Literally 'it is not even myself', from 我 (ware, 'I') + に (particle) + も (even) + あらず (negative form of あり, 'to be'). The phrase is classical in origin and remains a fixed literary expression.