She was proposed by EU Council and then elected by the parliament exactly as specified by the treaty:
> Taking into account the elections to the European Parliament and after having held the appropriate consultations, the European Council, acting by a qualified majority, shall propose to the European Parliament a candidate for President of the Commission. This candidate shall be elected by the European Parliament by a majority of its component members. If he does not obtain the required majority, the European Council, acting by a qualified majority, shall within one month propose a new candidate who shall be elected by the European Parliament following the same procedure.
Article 17(7) Treaty on European Union (TEU)
https://eur-lex.europa.eu/legal-content/EN/TXT/HTML/?uri=CEL...
To be honest, I don't even know what is the legal basis of the whole lead candidate idea. Do you know?