- Both are pronouns;
- Both refer to an unidentified person.
The difference between 'somebody' and 'anybody' is the same as the difference between 'some' and 'any'.
- 1.1. 'Anybody' can be used in negatives, affirmatives and in interrogatives.
- 1.2. 'Somebody' can be used in affirmatives and in interrogatives.
- 2.1. 'Anybody' means any person, it doesn't matter who (we don't know or we don't care).
- 2.2. 'Somebody' means any person, but we might have some ideas who, but we don't want to identify (we may not know who but we have some clues and know there is at least one person we're referring).
'Anybody' is a pronoun that refers to no specific person.
We use 'anybody' when we are speaking to a group of people or when there is no known person to refer to.
We are addressing a group of people, and we are asking if there is a person or several people in that group that can respond.
I don't know
'Anybody' can also be used in affirmative sentences with a meaning that is close to 'every'.
You can ask
'Somebody' is more specific than 'anybody'. Using 'anybody', we don't have any particular person in mind and we have no idea who that person can be. But when we use 'somebody' in some contexts, we may know the name of the person, but we omit his/her actual name.
The speaker uses the word 'somebody' to speak about a person without identifying them.
Sense of Hope
There's a subtle difference between 'anybody' and 'somebody' when used in questions.
When we use 'anybody', we're not expecting someone to answer us.
When we use 'somebody', we're expecting or hoping that at least one person will answer our question.
Subconsciously, the speaker knows no body is going to answer them; therefore, they're using 'anybody'.
Subconsciously, the speaker knows somebody's going to answer them; therefore, they're using 'somebody'.