Because baking recipes are based on ratios of very specific ingredients and chemical reactions between ingredients, substitutions for most baking ingredients require a certain amount of skill. Cocoa powder and unsweetened chocolate can certainly be substituted when "absolutely necessary", but in general we don't recommend this.
Cocoa powder
Cocoa powder is a dry solid particle made from fermented cocoa beans after drying and roasting. The cocoa beans are first broken into small pieces, and then ground into a paste - cocoa butter and cocoa bean residues. After the oil is removed, the remaining particles are ground into powder. This is cocoa powder - which contains complete cocoa solids.
Cocoa powder comes in two different forms: natural cocoa powder and alkalized cocoa powder. Natural cocoa powder retains the acidity of cocoa beans; alkalization is a product that is neutralized by adding alkaline chemicals. Alkalized cocoa powder has lower acidity, darker color, and softer aroma. Related: The specific differences and uses between the two types of cocoa powder.
When you know the origin of cocoa powder, you will understand its role in baking. Cocoa powder is low in fat and sometimes provides acidity in baking.
Unsweetened chocolate
It is somewhat similar to the production of cocoa powder. Unsweetened chocolate also goes through the process of pasting cocoa powder, but unlike cocoa powder, unsweetened chocolate is directly made from these cocoa powder. A block made from "cocoa paste", so it contains 0% sugar and 100% cocoa, naturally containing cocoa solids and oils (approximately 55% cocoa butter).
Then the question is, can one material be used instead of another? It's possible, but it's not recommended.
Cocoa powder has much less fat than unsweetened chocolate, which means the cocoa flavor is more specific and concentrated, and therefore, for baked goods, means you need more cocoa powder than unsweetened chocolate. Less chocolate can achieve the same flavor effect. As such, simply using it in place of unsweetened chocolate changes the proportions of ingredients and the amount of fat in the recipe—and if you don't take this into account, the resulting dessert will be questionable.