Graphite and diamond are both giant covalent forms of carbon, but their different structures give them very different uses.
In diamond each carbon atom forms four strong covalent bonds to four other carbon atoms, making a rigid three-dimensional network. A huge number of strong bonds must be broken to scratch it, so diamond is extremely hard with a very high melting point. It has no free electrons, so it does not conduct electricity. This is why diamond is used on the tips of cutting tools and drill bits.
In graphite each carbon atom forms only three covalent bonds, giving flat layers of hexagons. The fourth outer electron of each carbon atom is delocalised, which means it is free to move through the layer, so graphite conducts electricity. This makes it suitable for electrodes. The layers are held together only by weak intermolecular forces, so they slide over each other easily. This makes graphite soft and slippery, so it is used as a lubricant.