A nut is classed as a simple dry fruit with one seed (very occasionally two) and a hard shell which grow on trees. Examples of true nuts are chestnuts, hazelnuts, and acorns. However, peanuts, are not classed as nuts, they are actually a type of pea that grows underground.
Along with beans, peas and lentils, peanuts are classed as a legume. Legumes are a type of edible seed that grow inside small pods. The peanut plant flowers above ground but the peanut seeds (the bits we eat) mature underground and grow in small pods.