Set your oven rack in the middle position and heat it to 375°F. While it warms up, coat your 9x13-inch baking dish with cooking spray or a light layer of oil. This keeps the eggs from clinging to the sides once they puff up in the oven.
Warm the oil in a large frying pan over medium heat until it shimmers. Add the onion and cook for about 5 minutes, stirring often, until it turns soft and translucent. Stir in the diced potatoes and chopped Hatch chiles, then season with half the salt so the vegetables start absorbing flavor right away.
Keep cooking the mixture, stirring occasionally, for about 10 to 12 minutes until the potatoes are fork-tender but not falling apart. This step matters because raw potatoes will stay crunchy even after baking, so don't rush it. Once they're tender, remove the pan from the heat and let it cool slightly.
In a large bowl, whisk together the eggs, milk, sour cream, and the remaining salt until completely smooth. The sour cream is what gives this casserole its signature creaminess, so don't skip it or swap it for plain yogurt if you can help it. Whisk until there are no streaks of egg white left.
Spread the cooked potato, onion, and chile mixture evenly across the bottom of your prepared baking dish. Pour the egg mixture over the top, then sprinkle the shredded Monterey Jack cheese evenly across the surface. Give the dish a gentle shake so everything settles into place.
Slide the dish into the oven and bake for 30 to 35 minutes, or until the eggs are puffed, golden on top, and set in the center. You can test doneness by inserting a knife in the middle it should come out clean, without a wet egg clinging to it.
Let the casserole rest for about 5 minutes once it comes out of the oven. This short rest allows the eggs to firm up slightly, so your slices hold together instead of falling apart when you serve them.