It originated as a submissive statement in the slave patois, “yes sir, master, sir” corrupted to “yowsuh massa.” The feminine counterpart would be “yess’m.”
It entered into a different popular usage with the advent of jazz, and became rather exclamatory, but was still distinctively black, with roots in subjugation, although that is not how it was used, I believe intentionally. They took the old word and repurposed it into something else, that was unique to their scene and their era, took the sadness of their grandparents and made it into something good.
By the time of the would-be revolutionaries of the sixties, it had morphed into a pure exclamation of excitement or approval, to the point that a nascent, leftist, didactic word police felt the need to harangue it’s own flock of the word’s origin. It’s now seldom recognized for what it was, even among young, urban blacks.
So, they’re haranguing again. It’s a fine old word, as far as I’m concerned. It means what the speaker intends it to mean, no matter what some aging marxist didact claims.