The Latin name for it is tu quoque.
Like many logical fallacies, it is often misapplied - with this particular logical fallacy, it rather depends on context. In the case of moral statements, the fact that one does not adhere to it does not invalidate that one ought to. In the case of descriptive statements, the fact that the speaker does not adhere to it may be evidence that the descriptive claim is wrong.
Here is Evan Harper's example and a modified version:
- S condemns homosexuality but has been known to frequent gay bars. Therefore, homosexuality is morally acceptable.
- S believes sexual orientation/preference can be changed from homosexuality to heterosexuality using some method P, and S claims that they have successfully used P to change their own sexual orientation/preference. But S has been known to frequent gay bars subsequent to using method P. Therefore, we have reasons to doubt the efficacy of P, and perhaps to doubt the testimonial reliability of S (if S knows that he has been to gay bars, of course).
In case (1) we have a tu quoque, but I don't think we do in (2) even though both fit the argument schema on the above-linked nizkor.org page. I'm guessing most people are happy to grant that (1) commits the fallacy but (2) does not.
(As an aside, there may be valid defeaters for the conclusion in (2) - if visiting the gay bar was part of method P, or if it was explained away as a one-off lapse etc.)