The idea of equal rights resulted from the emergence and the ascent of the bourgeoisie in 17th and 18th century Europe, and was in the first instance, a tool for the protection of their interests. The bourgeoisie was, compared to the aristocracy, a relatively open class. One could enter and leave this class in a relatively free and sudden way and the moment of entering or leaving was sometimes hard to predict. For this reason, it was undesirable to create a new set of privileges in the style of those of the older classes. If the bourgeoisie was to have rights to protect its interests, they had no choice but to instate rights for everybody.
Historically, the transformation of privileges (or freedoms and rights limited to certain groups, such as guilds, corporations, the nobility etc.) into general or human rights was the invention of the revolutions of the 18th century. From this moment on, human rights were considered to be rights of individuals as entities detached from concrete relationships and groups.
Of course, in the beginning this was to a large extent rhetoric. Women and the working class didn’t have the same rights as white affluent men. There was also slavery, colonialism etc. It took centuries of struggle to make people aware of the contradictions between human rights philosophy and social reality. We have made enormous progress (slavery is abolished in many countries, the civil rights movement in the US has ended many types of discrimination like the Jim Crow laws etc) but still the struggle isn’t finished.