That is a very good question and I do not have a good answer. Maybe subjectively... that legitimate power is perceived as justified. I grew up in a communist regime and had the opportunity to experience the difference between obeying rules because you are afraid not to vs obeying rules because they are at least somewhat correlated to what the majority considers to be good. Sure, even in democracy you obey some rules just because you are afraid not to, but you also understand that you live in an imperfect world that is not centered around you and you can accept some level of power you don't perceive as justified as long as it is about something like zoning rules and not your fundamental freedoms.
But it seems highly subjective... maybe if I grew up in ancient Egypt I would believe that the pharaoh has the right do whatever he pleases and who am I to judge whether it is evil or not.