Preheat the oven to 375°F (190°C). Grease a 13x9-inch casserole dish.
Cook the penne according to package directions until al dente, drain, and transfer to a large heatproof bowl.
Add the shredded cooked chicken to the pasta and sprinkle the taco seasoning over the chicken; toss to combine.
Fold in the drained corn, rinsed black beans, diced tomatoes, chopped onion, and minced garlic until evenly distributed.
Stir in the enchilada sauce until everything is coated, then transfer the mixture to the prepared casserole dish and spread into an even layer.
Sprinkle the shredded cheddar cheese evenly over the top.
Bake uncovered for 15 minutes, or until the cheese is melted. If desired, broil on low for 2–3 minutes to brown the cheese—watch closely.
Remove from the oven and let the dish stand 10 minutes before serving. Garnish with chopped green onions and serve with sour cream if using.