I understand it to mean "error" or "screw-up" or "bad behavior". An abbreviated informal apology.
While some believe it to be a misinterpretation of the older phrase My Bag
it is clearly it's own slang with its own origins and meaning.
While playing pick up basketball a player who just made a mistake would say "My bad"