I believe it is because, since he is an ogre, he is not used to conversation.
People usually grab their torches and pitchforks when they first see him, he's never heard someone try to talk to him and ask him his name.
Therefore he is momentarily confused when someone asks his name, because he is not used to people approaching him like that, and also as dmckee added below, "he's not used to needing to remember a label for himself"
From http://en.wikiquote.org/wiki/Shrek#Shrek: (bolding mine)
Shrek: Listen, little donkey. Take a look at me, what am I?
Donkey: Uh... [looks Shrek up and down] really tall?
Shrek: No, I'm an ogre! You know, "Grab your torch and pitchforks!" Doesn't that bother you?
Donkey: [shakes his head happily] Nope.
Shrek: [surprised] Really?
Donkey: Really really.