Discredit means to cause mistrust or cast the accuracy of something into doubt. If you say that schooling is important to you, but you never study, your actions discredit you and your words.
You discredit what someone says when you choose not to believe it. You can discredit the rumors going around about your boyfriend if you are sure of his love. On a more personal level, you discredit people when you cast their authority or reputation into doubt. If you're running a tough race for class president, your opponent may try to discredit you by talking about your failures or even making up lies about you. But this would be to the discredit of your opponent — his or her own reputation would suffer for this bad behavior.