Melt butter in a large skillet over medium-low heat; add onions and cook, stirring occasionally, for 25 minutes until caramelized and deep brown.
In a separate skillet, brown the ground beef over medium-high heat until no longer pink, then drain all excess fat.
Season the beef with salt, pepper, garlic powder, cumin, and smoked paprika, then fold in the caramelized onions and let cool.
Preheat oven to 400°F (200°C) and line a large baking sheet with parchment paper.
Roll out the puff pastry on a lightly floured surface into a 10x12 inch rectangle.
Spread the beef and onion mixture evenly over the pastry, leaving a 1-inch border along the top edge.
Sprinkle the shredded Gruyere cheese over the beef layer.
Roll the pastry tightly into a log starting from the long edge closest to you, sealing the final seam with a touch of water.
Slice the log into 1-inch thick rounds using a sharp serrated knife.
Place pinwheels onto the baking sheet and brush the pastry edges with the beaten egg wash.
Bake for 18 to 20 minutes until the puff pastry is golden brown and the cheese is bubbling.