When you write and record a song, two rights are created: the right to the recording (a.k.a. the master) and the right to the underlying song itself (a.k.a. the publishing).
A music publisher is a company that owns or deals with publishing rights. A music publisher does things like collect royalties, place songs in films and television shows and match up songwriters with collaborators to create yet more songs. However, a music publisher doesn't have to do any of these things, unless it is required to do so by contract. Indeed, you yourself might be a music publisher without even knowing it, and you may or may not have done any of these things.
If you've written a song and haven't sold off or transferred all of your rights to someone else, you are a music publisher. If you have transferred your rights to someone else, that someone else is also a music publisher. Perhaps you've sold off your songs to a traditional publisher like Sony/ATV Music Publishing for a hefty advance, or perhaps you've given a company like Songtrust the exclusive right to administer your publishing rights, i.e., collect income on your behalf in exchange for a percentage of the profits. Those organizations are also music publishers.