Pot calling the kettle black

The pot calling the kettle black is an informal fallacy also called Tu quoque. 
Another name is appeal to hypocrisy. 
It happens when a person is guilty of the very thing of which they accuse another.
A fable, perhaps by Aesop, has a mother crab and its young, where the mother tells the child to walk straight, and is asked in return to demonstrate how that is done.
A present-day example:
It is a fallacy because a person's actions or character do not affect the logic of the argument.