Foodborne illnesses pose an escalating global threat, predominantly stemming from bacterial contamination. Despite a growing incidence rate in Malaysia, there remains a dearth of comprehensive studies utilising metagenomic approaches to analyse foodborne pathogens. This study aimed to assess microbial communities and identify foodborne pathogens in 27 samples, including vegetables, meats, and fruits through whole-genome shotgun metagenomic sequencing. Our analysis revealed a prevalent bacterial presence in most samples, with Proteobacteria and Firmicutes exhibiting notable abundance. Taxonomic profiling unveiled diverse microbial profiles, with specific genera indicating potential health hazards. Detection of common foodborne pathogens, including Escherichia, Salmonella, Listeria, Shigella, Vibrio, Cronobacter, Bacillus, Yersinia, and Klebsiella, underscored contamination risks associated with these food items. Importantly, our approach facilitated species-level taxonomic resolution, crucial for pinpointing potential foodborne pathogens. The detection of these pathogens in the samples highlights concerns regarding food safety and consumption risks. However, our findings also emphasize the potential of metagenomic sequencing to enhance pathogen detection techniques.