Why does a 39 year old male coworker (he's now a superior) at times raise his voice at me at work but then other times he says hi to me?

And other times he doesn't say hi to me.
Why does a 39 year old male coworker (he's now a superior) at times raise his voice at me at work but then other times he says hi to me?
Post Opinion