It means 'do something that I benefit from', or 'do something for me'.
e.g. 'Can you do me a favour - can you get me some milk on the way here', or 'Bob did me a big favour when he pulled out of the race' [allowing me to win]
it can also be used as a phrase sarcastically - suggesting that the person goes away.