This can happen for a few reasons: either you overmixed the batter after combining the wet and dry mixture, you didn’t use enough oil, you used storebought pre-shredded carrots instead of shredding them yourself, or the cake was overbaked.