The enchantment that Dumbledore puts on Hogwarts Castle was chosen to relate to the cell wall, because the spells protect Hogwarts like the cell wall protects the cell.
House Elves were chosen to represent chloroplasts, because the House Elves cook the food for the students at Hogwarts like the Chloroplasts produce food for the cell.
‘Harry Potter’: A decade of Hogwarts professors and first-class actors
The teachers at Hogwarts were chosen to represent the mitochondria, because the teachers keep the school running by teaching young wizards and witches the art of magic like the mitochondria is the source of energy of a cell.
Dumbledore was chosen to represent the nucleus of a cell, because Dumbledore is the main source of all things within Hogwarts just like the nucleus is the control center of a cell.