Why does my 1.5 year old say sorry so quickly


He is a very playful little boy that my husband and I love to pieces. Every now and then when I am trying l to stop him from doing stuff that can hurt, and I use a firm or slightly raised voice, he starts apologizing holding his ear. I have not taught him that. His grandma does ask him to say sorry on certain occasions casually so he knows the word. Why does he do that? It breaks my heart that he is scared of me or sensitive in that way. Any insight? I feel so sad when I hear him say that.