Heat the oven to 375°F (190°C).
Grease a 9 × 13-inch baking dish.
Melt the butter in a saucepan over medium heat.
Add the chopped onion and cook for 3–4 minutes, until softened.
Stir in the minced garlic and cook for about 30 seconds.
Add the flour and whisk for 1 minute to create a smooth roux
Gradually pour in the milk and heavy cream, whisking continuously until the mixture becomes smooth and slightly thickened.
Stir in 1½ cups of the shredded cheddar cheese until melted.
Season the sauce with salt, black pepper, and paprika.
Layer the casserole: Arrange half of the sliced potatoes in the prepared baking dish.
Add half of the diced ham over the potatoes
Pour half of the creamy cheese sauce evenly over the top.
Repeat the layers with the remaining potatoes, ham, and cheese sauce.
Cover the baking dish with foil and bake for 45 minutes.
Remove the foil and sprinkle the remaining ½ cup of shredded cheddar cheese over the top.
Bake uncovered for another 15–25 minutes, or until the potatoes are tender and the top is golden and bubbly.
Let the casserole rest for 10–15 minutes before serving. This allows the creamy cheese sauce to set and makes the casserole easier to slice.