Abstract Aims Infections have been associated with acute myocardial infarction (AMI), but differences in risk between infection types and age groups are unclear. This study aims to investigate whether infections are associated with subsequent AMI and whether the risk differs across infection sites and age groups. Methods Nationwide registers were used to include 702596 adults hospitalized between 1987-2018 with either; pneumonia (n=344319), urinary tract infection (UTI) (n=270101), soft tissue/bone infection (n=66718), central nervous system infection (CNS) (n=17025), or endocarditis (n=4433). Patients were sex- and age-matched with two unexposed controls. Outcome was first-time AMI within ten years. A time-dependent cox proportional hazards model with cut-offs at 30 and 90 days was used for calculating adjusted hazard ratios (HR). Results Pneumonia, UTI, and soft tissue/bone infection were associated with increased relative rates of AMI compared to matched, unexposed controls. Highest relative rates were found within the first 0-30 days post-exposure; Pneumonia: HR 3.39 (95% CI 3.15-3.65), UTI: HR 2.44 (95% CI 2.21-2.70), Soft tissue/bone infection: HR 1.84 (95% CI 1.45-2.33). Relative rates decreased over time but remained significantly elevated throughout the follow-up period and was increased in all age groups. No association was found for CNS infection and for endocarditis only at 31-90 days, HR 2.28 (95% CI 1.20-4.33). Conclusion Acute infections are associated with increased relative rates of AMI across different infection sites and age groups with higher relative rates found for pneumonia. This indicates that some infections may act as a trigger for AMI with a site and/or pathogen specific risk.