Prep the pan and air fryer. Line a 6-inch round cake pan (or 7-inch if that fits) with parchment on the bottom. Grease the sides. Preheat the air fryer to 320°F (160°C) for 5 minutes.
Preheating helps the cake rise evenly.
Mix dry ingredients. In a medium bowl, whisk flour, granulated sugar, brown sugar, baking powder, baking soda, salt, cinnamon, and nutmeg until no lumps remain.
Whisk the wet ingredients. In another bowl, whisk eggs, oil, and vanilla until smooth and slightly frothy, about 30 seconds. This builds a bit of structure for a better rise.
Combine batter. Pour wet ingredients into dry and stir with a spatula until just combined. Fold in the grated carrots and drained pineapple.
If using, fold in nuts and raisins. The batter should be thick but scoopable.
Load the pan. Scrape the batter into the prepared pan and smooth the top. Tap the pan once on the counter to pop large air bubbles.
Bake in the air fryer. Place the pan in the air fryer basket.
Cook at 320°F (160°C) for 28–34 minutes, or until a toothpick comes out with a few moist crumbs but no wet batter. If the top browns too quickly, tent loosely with foil during the last 10 minutes.
Cool completely. Let the cake cool in the pan for 10 minutes. Run a knife around the edge, then remove to a rack to cool fully before frosting.
Warm cake will melt frosting.
Make the frosting. Beat cream cheese and butter until creamy. Add powdered sugar gradually until smooth and spreadable. Mix in lemon juice or milk 1 teaspoon at a time to reach your desired texture.
Taste and add a pinch of salt if you like a tangier finish.
Frost and finish. Spread frosting over the cooled cake. Top with extra chopped nuts or a light dusting of cinnamon if you want a little flair.
Serve. Slice with a sharp, warm knife for clean cuts. This cake is even better after resting 30 minutes once frosted.