The concept if legitimacy is central in political science. However, after reading about it, I found out that it is much more complicated than I had anticipated.
Before thinking about legitimacy we have to think about acceptance. Typically, you will not question a decision if the results are fine. And even if you are harmed by another person's decision you may still accept it because you can understand how they got there. On the other hand, you may not accept a totally fine decision simply because you have a bad day.
Legitimacy is an attempt to free the concept of acceptance from subjectivity. I know of two variations: A decision can be defined as legitimate if it is accepted by practically everyone (intersubjective) or if it is worthy of being accepted (objective).
We usually use a set of rules to decide whether a decision is legitimate. The set of rules is often called "the democratic process" (note that there are different variations of this). If we follow the objective definition, this set of rules ensures that the decision is worthy of acceptance, i.e. it helps making a good decision. According to the intersubjective definition on the other hand, following these rules is merely a symbolic gesture based on social norms. So the question here is whether different processes can be better or just incompatible.
Think of consensus vs secret majority voting: These processes are incompatible as each one has features that are forbidden in the other one. Is any of these objectively better? Is a decision based on consensus more worthy of acceptance than one based on majority vote? Or are these simply different "democratic cultures"?
As long as there is no clearly superior set of rules, the concept of legitimacy fails at its attempt of being objective. Attacking a decision for being illegitimate is basically the same as saying that you follow different social norms. So in the end, I am not sure if the concept of legitimacy has any benefit at all.
As a final note, I want to highlight one interesting feature of legitimacy: In the very beginning I said that you do not typically question a decision if the results are fine. So legitimacy does not only depend on the process of making a decision (input) but also on its results (output). Of course, the output can not be controlled completely. So even if you followed all the rules, your decision can still turn out illegitimate. On the other hand, this also explains how the decisions of a "just king" can be seen as legitimate.