Preheat the oven to 350°F (175°C).
In a large skillet, melt the butter over medium heat and sauté the diced onions until translucent, about 5 minutes.
Add the ground beef to the skillet, breaking it up with a spoon. Cook until browned and cooked through, about 7-10 minutes.
Stir in the minced garlic, cooking for an additional minute until fragrant.
Season the mixture generously with salt and pepper, to taste.
Peel and slice the potatoes thinly; layer half of them in a greased baking dish.
Spread the beef mixture evenly over the potatoes, then layer the remaining potatoes on top.
Pour the milk evenly over the top, allowing it to seep through the layers.
Cover the dish with aluminum foil and bake for 45 minutes.
Remove the foil, sprinkle the top with shredded cheddar cheese, and bake uncovered for an additional 15-20 minutes, or until the cheese is melted and bubbly.
Allow the casserole to cool for a few minutes before serving.