Anything that's self-defeating acts against its own plan or purpose — it's unsuccessful or useless. If you really want to make friends with someone, it would be self-defeating to say something mean to them.
If your actions keep the thing you really hope for from working out, they're self-defeating. It's also self-defeating to be drawn to people who will inevitably treat you badly, or to eat foods you know are going to make your stomach hurt later. Behavior that seems destined to harm you — writing your friend's English paper but not your own, for example — is also self-defeating. Defeating stems from the Vuglar Latin diffacere, "destroy or undo."