The olfactory receptor (OR) gene family is the largest in mammals, with its repertoire size and functional status tightly linked to ecological adaptation. Here, we systematically identified and compared OR genes in 25 carnivoran species, including both marine and terrestrial carnivores, to investigate evolutionary patterns under different ecological backgrounds. Marine carnivores exhibit a significant reduction in OR gene numbers and an increased proportion of pseudogenes, consistent with diminished reliance on olfaction in aquatic environments. Strikingly, giant panda—despite being terrestrial—shows a similar genomic signature, with reduced OR gene numbers and high pseudogene proportions. Phylogenetic and selective stress analyses revealed that both giant pandas and Marine carnivores experienced the loss of OR genes and weakened functional constraints. Principal component and regression analyses further demonstrate that dietary specialization and restricted ecological niches are likely major drivers of OR gene evolution. Collectively, these findings suggest that the degeneration of giant panda’s OR genes is closely tied to its unique ecological niche and resembles patterns observed in marine carnivores, providing new insights into the ecological drivers of sensory genome evolution.