Mix Gruyere cheese and panko bread crumbs together in a bowl.
Heat butter in a large skillet over medium heat until melted. Add zucchini, yellow squash, shallots, and garlic; cook and stir until softened, about 10 minutes. Stir in basil, rosemary, salt, and black pepper; cook until fragrant, about 1 minute.
Mix flour into the skillet. Pour in cream in a steady stream and stir until thickened, 3 to 5 minutes. Mix in half the cheese mixture. Remove from heat.
Pour zucchini mixture into a baking dish. Top with remaining cheese mixture.
Bake in the preheated oven until bubbly and golden brown, about 20 minutes.