Due to the intricate complexity of the original microbiota, residual heat-resistant enzymes, and chemical components, identifying the essential factors that affect dairy quality using traditional methods is challenging. In this study, raw milk, pasteurized milk, and ultra-heat-treated (UHT) milk samples were collectively analyzed using metagenomic next-generation sequencing (mNGS), high-throughput liquid chromatography-mass spectrometry (LC-MS), and gas chromatography-mass spectrometry (GC-MS). The results revealed that raw milk and its corresponding heated dairy products exhibited different trends in terms of microbiota shifts and metabolite changes during storage. Via the analysis of differences in microbiota and correlation analysis of the microorganisms present in differential metabolites in refrigerated pasteurized milk, the top three differential microorganisms with increased abundance, Microbacterium (p < 0.01), unclassified Actinomycetia class (p < 0.05), and Micrococcus (p < 0.01), were detected; these were highly correlated with certain metabolites in pasteurized milk (r > 0.8). This indicated that these genera were the main proliferating microorganisms and were the primary genera involved in the metabolism of pasteurized milk during refrigeration-based storage. Microorganisms with decreased abundance were classified into two categories based on correlation analysis with certain metabolites. It was speculated that the heat-resistant enzyme system of a group of microorganisms with high correlation (r > 0.8), such as Pseudomonas and Acinetobacter, was the main factor causing milk spoilage and that the group with lower correlation (r < 0.3) had a lower impact on the storage process of pasteurized dairy products. By comparing the metabolic pathway results based on metagenomic and metabolite annotation, it was proposed that protein degradation may be associated with microbial growth, whereas lipid degradation may be linked to raw milk's initial heat-resistant enzymes. By leveraging the synergy of metagenomics and metabolomics, the interacting factors determining the quality evolution of dairy products were systematically investigated, providing a novel perspective for controlling dairy processing and storage effectively.