Another way to say that you are sorry for making a mistake or doing something wrong even if you are making up for it or not.
People can say "my bad" if they knock over your drink by mistake and buy you another one to replace the drink that has been knocked over.
Or they can just say "my bad" and just walk away and act like it never happened.
Same scenario goes for people saying "I'm sorry and knocking over a drink by mistake."
For the wrong doing, a person can break your windows and later say "my bad" and replace your windows.
Also they can say "my bad" and never replace your windows.
Again..same scenario for people saying "I'm sorry" for breaking your windows.