Position an oven rack in the middle and preheat the oven to 425°F (220°C).
Line a baking sheet with a large piece of aluminum foil, leaving enough foil to fold over and fully enclose the salmon.
Place the salmon, skin-side down if applicable, on the prepared foil.
In a small bowl, stir together the melted butter, chopped garlic, and lemon juice until combined.
Pour the butter mixture evenly over the salmon, then sprinkle with kosher salt, ground black pepper, and chopped rosemary.
Fold the foil over the salmon and seal the edges to make a packet.
Bake the foil-wrapped salmon in the preheated oven for 12 minutes.
Carefully open the foil packet, switch the oven to the broil setting on high, and broil the salmon uncovered for about 5 minutes until the top is lightly browned and cooked through.
Remove the salmon from the oven, transfer to a plate, and serve immediately.