Preheat the oven to 375°F (190°C) and grease a 13x9-inch (33x23 cm) casserole dish.
Cook the penne according to package directions until al dente; drain in a colander and transfer to a large heatproof bowl.
Add the shredded cooked chicken to the pasta, then sprinkle the tablespoon of taco seasoning over the mixture and stir to combine.
Stir in the drained corn, drained and rinsed black beans, and diced tomatoes.
Add the finely chopped onion and minced garlic, then mix everything until evenly distributed.
Pour the enchilada sauce over the mixture and stir gently to coat all ingredients.
Transfer the mixture to the prepared casserole dish and smooth the top.
Sprinkle the shredded cheddar cheese evenly over the top.
Bake uncovered for 15 minutes, or until the cheese is melted; optionally place under a low broiler for 2–3 minutes to brown the cheese (watch closely).
Let the casserole stand for 10 minutes before serving. Garnish with chopped green onions and serve with sour cream as desired.