In a large skillet, heat the olive oil over medium heat.
Add the onions and garlic and sauté for 5 minutes until softened.
Stir in the drained tomatoes, tomato paste, green chiles, chili powder, oregano, salt, and pepper. Increase the heat to high and cook, stirring frequently, for about 5 minutes, until the liquid has evaporated.
Add the drained and rinsed kidney beans to the skillet and toss to combine everything thoroughly.
Remove the pan from the heat.
Preheat your oven to 375°F / 190°C.
Spread half of the bean mixture into a large casserole dish.
Top it with half of the sour cream and half of the grated cheese.
Repeat the layers with the remaining bean mixture, sour cream, and cheese.
Bake for 20 to 25 minutes, or until the casserole is hot, bubbly, and the cheese is beautifully melted.
Let it rest for a few minutes before serving.