I think that the speaker is suffering from feelings of inferiority. He thinks that other people are better than him in so many ways. He thinks about how other people are more popular that he is. He thinks about how they are better than he is at this or that thing. It really sounds to me like how young people often think. They get to be insecure because they are aware of all their own faults and they feel like other people are better than them at everything.
So I think it's just the normal sort of insecurity and feelings of inferiority that we all have, particularly when we are young or when we are not feeling successful because of relationships, careers, etc.
The simple answer is that we are never told and so we don't know. Many critics have tried to view this sonnet as an example of Shakespeare's life intruding into his poetry, suggesting that the shame and "outcast state" that the speaker bemoans at the beginning of the sonnet is actually a reflection of Shakespeare's unhappiness with his position in society, perhaps produced by his alleged bisexuality. However, such critics are erroneous in forgetting that these sonnets are not autobiographical, and, although we are never told the reason for the shame of the speaker, that, in a sense, is not the point. The point is the way that his love for his beloved is able to transport him out of this state and make him better and worthier than those with whom he would exchange places with earlier on in the poem:
For thy sweet love remembered such wealth brings
That then I scorn to change my state with kings.
This sonnet then is really a celebration of the power of love to transport us out of our own situations and make us better people. The sonnet gives us a conventional "happy ending" as we focus on the way that love has the power to exalt even the most unhappy.