Symbioses are major drivers of organismal diversification and phenotypic innovation. However, how long-term symbioses shape whole genome evolution in metazoans is still underexplored. Here, we use a giant clam (Tridacna maxima) genome to demonstrate how symbiosis has left complex signatures in an animal’s genome. Giant clams thrive in oligotrophic waters by forming a remarkable association with photosymbiotic dinoflagellate algae. Genome-based demographic inferences uncover a tight correlation between T. maxima global population change and major paleoclimate and habitat shifts, revealing how abiotic and biotic factors may dictate T. maxima microevolution. Comparative analyses reveal genomic features that may be symbiosis-driven, including expansion and contraction of immunity-related gene families and a large proportion of lineage-specific genes. Strikingly, about 70% of the genome is composed of repetitive elements, especially transposable elements, most likely resulting from a symbiosis-adapted immune system. This work greatly enhances our understanding of genomic drivers of symbiosis that underlie metazoan evolution and diversification.