Originally "city-dwellers". During the middle ages, farmers and the lower class left the fields to live in cities. As they got richer, they gave birth to the middle class: Non-nobles with power. Thanks to their influence feudalism became more democratic, and after years of hard work they managed to switch sides from the oppressed to the oppressors. In countries like Russia the fall of the monarch led to a class struggle where bourgeois, the middle class, where seen as evil as the upper class.
Even if today the noun has lost all relevance, some SJW insist on using it as an insult while the peasants who grow their food still have to work their asses off for less than minimum wage.
Karl: I really fucking hate bourgeois.
Pepe: Said the car-driving, city-dwelling university student.