There's nothing wrong with cleaning under your finger nails, just make sure your nails are long enough and you aren't hurting yourself. Everyone has little habits like this, it's natural these days -apes like to use their hands, right?
If you don't want to be able to scratch your head as much, washing your hair more often will prevent you from doing it as often, it will also help keep your scalp somewhat moisturized, which will prevent the scabbing over.