The often cited claim that the EU is undemocratic stems from a difference of opinion what "democratic" actually means.

First of all: there is barely any nation that is truly democratic in the historic sense of the word. Most democracies are actually representational systems: citizens don't vote on every single issue, they elect someone to represent them and vote in their name. Who each representative actually represents and how their votes are weighed varies but this is what almost all so-called democracies in existence have in common.

Additionally representatives may sometimes again elect other representatives who vote in their name in another group, or they may elect solitary rulers who act in their name. Keep in mind, this is a gross (and incorrect) simplification, but these are all things that happen in systems most people would call democratic.

Specifically:

The European Parliament is elected in a way most people would agree can be described as democratic: every EU citizen gets a vote. The MEPs are directly elected. This is pretty straightforward and not unlike how national governments are generally elected.

The MEPs elect the President of the European Parliament. Depending on what your national government's elections look like this may also be perfectly normal and expected.

There's also the European Commission. This is where things get slightly weirder: the Commission consists of one person per member nation but they are bound by oath to the EU rather than their own nation. One of them is the President of the European Commission who is proposed by the European Council and then confirmed by the European Parliament. The Council then nominates the other commissioners which are approved by the President of the European Commission.

The European Council in turn consists of all heads of state of the member nations plus the President of the European Council and the President of the European Commission (but they don't get to vote). The President of the European Council in turn is elected by the European Council.

So in other words there are basically two groups of people both ultimately elected by EU citizens:

As a EU citizens you get a direct vote for the European Parliament, which elects the President of the European Parliament.

Additionally you (presumably) get a direct vote in your own national elections and your elected national governments gets to send its head of state (or a representative, plus maybe some non-voting attendees) to the European Council, which elects the President of the European Council.

Finally both the European Council and European Parliament (i.e. the representatives of the citizens and the representatives of the member nation governments) together elect the European Commission.

Yes, it's complicated (but in honesty all governments are if you try to understand them in detail) but I can't for the life of me see why you would call them undemocratic in comparison to any other "democratic" system.

I think "undemocratic" is just a shorthand for "subject to the will of other people than my own nation's citizens", which is the entire point of the EU and the only way you can have international organisations.

The complaint makes much more sense if you consider that the perspective of the EU critics that usually make this complaint isn't "we're part of the EU" but "the EU tries to tell us what to do". It's not so different from Americans who complain about "the government" because they see their ultimate authority at the state level than the federal level.