"Cacao" is the bean that comes from the cacao tree, which is known by the scientific name of Theobroma cacao. Cacao pods - large football-shaped fruits - grow off the trunk and limbs of the cacao tree, and cacao beans are found inside the pods.
The beans are harvested, fermented and dried. They are then cleaned and roasted, after which point the products are often referred to as "cocoa." In other words, "cocoa" is what the bean is called after it has been processed.
Read more about the processing steps here.