Shares are registered instruments, meaning that a name has to be recorded on the relevant share register to reflect legal ownership.
It is common for a broker with many clients to put their own name on the register. That makes the broker the legal owner of the shares however the beneficial owner is the underlying shareholder because they will ultimately benefit from any share price growth and/or income paid by the underlying company.