A market maker is a market participant, which keeps the inventory of securities and sells or buys them to gain from the difference.
Market makers play a vital role in liquidity of the asset as they deal in the actual inventory of the asset and can make available or buy back the securities from the market. They are called dealers as well.
A market maker can be an individual or a broker. Foreign exchange dealers are also a kind of market makers, as they hold the physical currencies with them provide investors with them during trade.
Market makers earn the bid ask spread as they set the quote, the bid-ask rate, at which other investors can buy from them or/and sell to them, dictating the liquidity of that asset. .