Preheat oven to 350°F (175°C). Grease a 3-quart (9x13 inch) casserole dish with 1 tablespoon of butter.
In a large pot or Dutch oven over medium heat, melt the remaining 4 tablespoons of butter. Whisk in the flour and cook for 2 minutes, whisking constantly, to remove the raw flour taste.
Gradually pour in the milk and heavy cream while whisking continuously to prevent lumps. Add the salt, black pepper, onion powder, and garlic powder.
Simmer the sauce until it thickens slightly. Remove from heat and stir in 1 cup (half) of the grated Gruyere cheese until melted and smooth.
Thinly slice the potatoes to 1/8-inch thickness (using a mandoline is recommended). Do not rinse the potatoes.
Add the sliced potatoes directly into the pot with the cheese sauce and toss gently until every slice is evenly coated.
Transfer the potato mixture into the prepared casserole dish, spreading it out evenly.
Sprinkle the remaining 1 cup of Gruyere cheese over the top.
Cover the dish tightly with aluminum foil and bake for 60 minutes.
Remove the foil and bake uncovered for another 15-30 minutes, or until the potatoes are tender and the top is golden and bubbly. For extra color, broil for 2-3 minutes at the end if desired.
Let the dish rest for at least 15 minutes before serving to allow the sauce to set.