In the graphite, each carbon is attached to three other carbon by a single covalent bond and satisfies its fourth valency by forming a pi bond with another carbon atom.
The structure of graphite consists of an array of hexagonal rings in which layers are held together by Vander Waal force of attraction.
Due to the presence of weak Vander Waal force of attraction among the layer, they can slide over each other leading to the slippery nature of graphite.
Hence, graphite is used as a better lubricant due to the slippery nature of graphite.