I do this, myself, though not for the same reasons, exactly, as I've never gone in late consistently to class or done anything like that.
I tend to screw up - a lot. I am very accident prone, and I also take teacher's instructions the wrong way. Sometimes I just have a bad week, and end up bringing some horrible work in because I couldn't do anything else. When things like that happen, I feel the need to make up for it, so that the teacher does not think I am stupid or slacking. It's just a way for me to reassure my teacher that I was not deviating intentionally or that I am actually capable of doing things.
On the other hand, it is unlikely that I would do anything that is out of character to impress someone. For example, if I never raised my hand in class, I would not raise my hand in class after screwing up- I'd probably just try to write a knock-out paper or do a really good piece of art, because those are the areas in which I feel I am stronger, and where I would like to prove myself.
The basic idea is "show it, don't say it." People are less inclined to believe your words than they are your actions.