The portrayal of planets in science fiction often stems from several reasons:
Familiarity: Planets are relatable to the human experience. They are celestial bodies similar to our own Earth, with landscapes, atmospheres, and ecosystems. By using planets as settings, science fiction writers can create environments that readers or viewers can easily envision and connect with.
Narrative Possibilities: Planets offer diverse settings and storytelling opportunities. They can be used to explore themes such as colonization, exploration, terraforming, or encounters with alien life. Planets provide a tangible and visually stimulating backdrop for adventures, conflicts, and world-building.
Visual Appeal: Planets are visually striking and lend themselves well to cinematic and artistic depictions. The grandeur of a planet's landscapes, skies, and natural wonders can be awe-inspiring and visually captivating on screen or in illustrations.
Regarding your point about rotating space habitats, it's important to note that science fiction does explore various types of advanced civilizations and their habitats, including space stations, O'Neill cylinders, and Dyson spheres. However, planets often receive more attention due to the reasons mentioned above.
Additionally, rotating space habitats, while scientifically feasible and potentially more practical for long-term habitation, may not be as visually captivating or relatable to a general audience. They lack the natural landscapes, biodiversity, and inherent sense of exploration that planets offer.
That being said, different science fiction works take different approaches, and there are examples of stories that heavily feature artificial habitats or focus on advanced civilizations that have moved beyond planetary environments. Science fiction is a vast genre that encompasses a wide range of ideas, concepts, and settings, so there is room for exploration and representation of various types of habitats and civilizations beyond just planets.