The problem lies in you taking things so personally. I also think your way out of bounds, but do understand you were caught off guard.
Next time ask him if he needs your help, before you runaway hurt, and distressed.
Or learn to knock first, or cough, or something, before you bust in. This ain't a big deal.