Place onion, butter and brown sugar into a large skillet over low heat. Cook, stirring occasionally, until the onions have caramelized, about 45 minutes.
Preheat the oven to 350 degrees F (175 degrees C). Coat a 9x13 inch baking dish with cooking spray.
Place a single layer of potato slices in the bottom of the prepared baking dish. Cover with a thin layer of onions. Drizzle some of the cream, and sprinkle some of the rosemary over the layer. Repeat layers four times ending with onions, cream and rosemary.
Bake for 1 hour in the preheated oven, or until top potatoes are golden brown and sauce is bubbling.