It does depend on whether he knows he is doing it at all or if he has no awareness of space?
Assuming that he does know he's doing it, I'd keep it very very simple, and if he hits you with something, take it from his hand, and say "no" in a very calm, but very firm voice. Or "no hitting".
Give the object back to him and if he does the same thing, repeat the "no".
Don't say or do anything else. Don't touch him in any way, or say anything other than that. Absolutely no punishment is meant - just that he gets no attention for doing this. The more you react, the more he'll continue, as he's thinking "ooh great I get a funny response when I do that, I'll do it again!".
When he does give it to you nicely, go overboard with praise, attention, whatever he would like best (cuddles, tickles, kisses, whatever).
The simple message is that he gets rewarded for giving it nicely, but gets nothing for hitting you with it.
Facial expressions probably a bit complex for him atm if he's only 2yo and asd. I'd stick with very basic verbal/physical instruction.