* Noun: When referring to the nut itself or the tree that produces it (e.g., "I ate a roasted chestnut." "The chestnut tree was covered in leaves.")
* Adjective: When describing something as being the color of a chestnut (e.g., "Her hair was a beautiful chestnut brown." "He wore a chestnut-colored sweater.")
So, you need more context to determine the specific part of speech.