Prepare the Apples and Baking Pan: Preheat the oven to 350°F (175°C). Grease a 9-inch square baking pan and line the bottom with parchment paper if desired. Wash, peel if preferred, and dice the apples into small, evenly sized pieces.
Combine the Dry Ingredients: In a medium bowl, whisk together the all-purpose flour, baking powder, baking soda, cinnamon, nutmeg, ginger, and salt. Mix until the spices and leavening agents are evenly distributed.
Cream the Butter and Sugars: In a large mixing bowl, beat the softened butter with the brown sugar and granulated sugar until creamy and slightly fluffy. Add the egg and vanilla extract, then mix until well combined.
Make the Cake Batter: Add the dry ingredients to the butter mixture in portions, alternating with the milk. Begin and finish with the dry ingredients. Gently fold in the diced apples and optional chopped nuts, mixing only until combined.
Fill the Pan and Bake: Spread the batter evenly in the prepared baking pan. Bake at 350°F (175°C) for approximately 30–35 minutes, checking toward the earlier end of the baking time. The cake is ready when a toothpick inserted into the center comes out clean or with a few moist crumbs. If needed, continue baking in short intervals.
Cool and Serve: Let the cake cool in the pan for 10–15 minutes. Allow it to cool further before slicing for neater portions. Dust with powdered sugar if desired, or serve with whipped cream, caramel sauce, or vanilla ice cream.