The optimal foraging theory posits that animals select food patches based on a trade-off between energy consumption and resource quantity. We hypothesized that giant pandas (Ailuropoda melanoleuca) forage at locations with gentle slopes to minimize energy consumption. However, animal-trace data from two national surveys in the Qinling Mountains suggest that giant pandas actually prefer steep locations. To explore the cause of this apparently counterintuitive preference, we analyzed panda utilization of two slope intervals (5–15° and 15–25°) and measured daily movement areas adjacent to those slopes. Our results showed that the daily movement area of the pandas at these two locations were similar in terms of slope composition, implying that the steepness of the surrounding environment did not influence space selection. In addition, giant pandas exhibited a strong preference for utilizing flat land (0–5°) around gentle slope traces, and the 5–15° slope had a greater density of panda traces than the 15–25° slope, strongly supporting the hypothesis that giant pandas prefer flatter regions. Furthermore, we observed that the 5–15° slope was considerably smaller in area than the 15–25° slope (83.39 < 257.57 km²). This difference likely explains the initially observed unusual slope utilization, suggesting that giant pandas may have been forced to inhabit steep areas due to the scarcity of their preferred sites. This study verified that pandas of Qinling foraged optimally within the constraints of habitat availability, providing insights that should benefit future assessment and restoration of their habitats.