Prepare the butternut squash: Preheat the oven to 375°F. Peel the butternut squash, cut it in half lengthwise, and scoop out the seeds. Using a mandoline or sharp knife, slice the squash into thin, even slices, approximately ⅛ inch thick.
Caramelize the onions: Melt 1 tablespoon of butter in a skillet over medium-low heat. Add the thinly sliced yellow onion and a pinch of salt. Cook for 20–25 minutes, stirring occasionally, until the onions are soft, golden brown, and caramelized. Reduce the heat if the onions begin to brown too quickly, adding a splash of water as needed to prevent sticking. Remove from the heat and set aside.
Make the Boursin cream sauce: In a small saucepan over low heat, melt 1 tablespoon of butter. Stir in heavy cream and Boursin cheese. Stir until smooth and the sauce begins to thicken, about 2 minutes. Add the nutmeg, salt, and black pepper.
Prep the cocotte: Butter the inside of a 24 oz cocotte, coating the bottom and sides. Add a few leaves of fresh thyme along the bottom and sides of the cocotte.
Layer the squash and caramelized onions: Arrange a layer of thinly sliced butternut squash over the thyme, slightly overlapping the slices. Season lightly with salt and pepper. Add a thin layer of caramelized onions over the squash. Repeat the layers of squash and onions until the cocotte is nearly full, finishing with a layer of squash.
Add the Boursin cream sauce and Gruyère: Slowly pour the Boursin cream sauce evenly over the layered squash, allowing it to settle into the spaces between the slices. Gently tap the cocotte on the counter to help distribute the sauce. Sprinkle the freshly grated Gruyère cheese evenly over the top.
Bake the gratin: Cover the cocotte and bake at 375°F for 20 minutes. Remove the lid and bake for another 20 minutes, or until the squash is tender and the cheese is golden. Finish under the broiler for 2–3 minutes until the top is bubbling and browned, watching closely to prevent burning. Remove and top with chopped chives. Enjoy!