Prepare the Caramel: In a small saucepan over medium heat, melt the sugar, stirring occasionally, until it turns into a golden brown caramel.
Immediately pour the caramel into the bottom of a round or oval baking dish (or individual ramekins), tilting the dish to coat the bottom evenly. Set aside to cool and harden.
Make the Flan Mixture: Preheat your oven to 350°F (175°C). In a large bowl, whisk together the sweetened condensed milk, coconut milk, eggs, and vanilla extract until smooth and fully combined. Stir in the shredded coconut.
Assemble the Flan: Pour the coconut flan mixture over the hardened caramel in the baking dish or ramekins.
Bake the Flan: Place the baking dish inside a larger pan and fill the outer pan with hot water, creating a water bath (bain-marie) to gently bake the flan. Bake for 45–55 minutes, or until the flan is set and slightly jiggly in the center. You can test it by inserting a knife into the center—it should come out clean.
Cool and Serve: Take the flan out of the water bath and allow it to cool to room temperature. After it has cooled, place it in the refrigerator for a minimum of 3 hours, or overnight for optimal results. To serve, run a knife around the edges to loosen the flan, then invert it onto a plate to reveal the caramel topping. Garnish with extra shredded coconut if desired.