Arrange a rack in the middle of the oven and heat the oven to 375°F. Lightly coat a 9x13-inch baking dish with cooking spray.
Prepare the following, adding each to the baking dish as you complete it: Grate 6 ounces sharp cheddar cheese on the large holes of a box grater (about 1 ½ cups). Drain and rinse 1 (about 15-ounce) can black beans. Drain 1 (4-ounce) can chopped green chiles (do not rinse).
Add 1 (20-ounce) bag frozen shredded hash brown potatoes, breaking up any large clumps with your hands. Stir to combine, then spread into an even layer.
Place 10 large eggs, 1 cup sour cream, 1 cup whole or 2% milk, 1 ½ teaspoons kosher salt, and ¼ teaspoon black pepper in a large bowl and whisk until smooth. Pour over the vegetable mixture.
Bake until the top is light golden-brown and a knife inserted in the center comes out clean, 45 to 60 minutes. Let cool for 5 minutes before slicing. Serve with sliced avocado, fresh cilantro, and salsa, if desired.
