In diamond each carbon atom forms four covalent bonds to four other carbon atoms. The bonds point in all directions, so the atoms form a rigid, giant three-dimensional lattice. All four outer electrons of every atom are used in bonding, so diamond has no delocalised electrons.
In graphite each carbon atom forms three covalent bonds to three other carbon atoms. The atoms join in hexagonal rings that make flat layers. The layers are held together only by weak forces, so they are not bonded to each other by covalent bonds.
A carbon atom has four outer electrons. In graphite only three are used in bonding, which leaves one electron per atom that is delocalised and free to move between the layers.