Preheat the oven. Preheat the oven to 375°F. Lightly grease a 9x13-inch baking dish.
Cook the potatoes. Place the peeled, cubed potatoes in a large pot of cold water. Bring to a boil and cook for 15-20 minutes, until fork-tender. Drain thoroughly.
Steam the broccoli. While the potatoes cook, steam the chopped broccoli for 3-4 minutes, until tender. Drain well and remove excess moisture.
Mash the potatoes. Transfer the drained potatoes to a large bowl. Add butter and warm milk. Mash until smooth and thick.
Season the mixture. Stir in garlic powder, onion powder, salt, black pepper, Parmesan cheese, and ½ cup cheddar cheese.
Add the egg. Allow the potatoes to cool slightly. Beat the egg separately, then stir it into the potato mixture until fully combined.
Add the broccoli. Gently fold the cooked, well-drained broccoli into the mashed potatoes.
Make the bottom layer. Spread half of the potato and broccoli mixture evenly across the bottom of the prepared baking dish.
Add the filling. Sprinkle the diced fully cooked ham over the potatoes, followed by the shredded mozzarella, leaving a small border around the edges.
Cover the filling. Spoon the remaining potato and broccoli mixture over the ham and cheese. Spread gently to cover the filling completely.
Bake. Place in the preheated oven and bake uncovered for 20 minutes.
Add the topping. Sprinkle the remaining ½ cup cheddar cheese over the casserole.
Finish baking. Return to the oven for another 10-15 minutes, until the cheese is melted, the top is lightly golden, and the center reaches 165°F.
Rest and serve. Allow the casserole to rest for 10 minutes. Sprinkle with parsley, cut into 8 portions, and serve warm.