a broker buys and sells stocks for their clients. They get paid commissions for doing this. It s kinda like being realestate agent, the broker is the middle man between 2 investors those that want to buy and those that want to sell.
broker dealers also have their own "book", apart from buying/selling on clients behalf they can buy/sell for their own position.