EU commission president isn’t directly elected, but neither is the US. President. Voter choose electors who then pick the US president. In EU: voters elect national parties that form groups in the Parliament, which then elects the Commission President.

The two are not comparable. In the US, the presidential candidate is known in advance and people vote mostly for the candidate they want, even if indirectly.

In the EU, no party runs with a candidate for the commission. Those are decided only after the election and are often people that would have lost a party votes if they were known in advance.

So they are both elected indirectly but US president candidates are more well known for a longer time. Got it.

some extra detail: comission president is a two-stage process: The European Council (representatives of the member states, either head of state or head of the government) proposes, the Parliament confirms or vetoes.