Shouted at in the gym

I’m fairly new to the gym (2-3 months) and have never seen or had this happen to me before. Went to re rack dumbbells that I was using and there was a guy standing right in front of the rack doing curls blocking all the weights. I went to move closer to the rack assuming he would realise and step out the way. Instead he stopped and started literally screaming and swearing at me saying I shouldn’t have interrupted him. I apologised and walked away but the whole thing really threw me off as I’ve never seen anyone behave that way in the gym. Should I have waited for him to finish his set?