Like a real estate broker, a mortgage broker is also an agent, who represents a principal. The function of a mortgage broker is to represent a person or business who wishes to obtain a mortgage. The prospective borrower is the principal; the mortgage broker is the agent.
A mortgage broker generally will have relationships with numerous lenders and lending sources. If he or she is competent, he or she should be able to advise the prospective borrower on prevailing interest rates and what sorts of loans are available to a borrower with a certain credit score and situation.
A borrower is not required to use a mortgage broker, and many do not. If you have a pre-existing relationship with a lender, such as a credit union, it is often a good idea for you to approach the lender directly, and see if they are able to make a loan to you, which meets your needs.