Former New York Mayor Michael Bloomberg is donating $300 million to the Johns Hopkins Bloomberg School of Public Health in Baltimore to finance an ambitious effort to target opioid addiction, gun violence and other issues that are shortening lives and disrupting communities across the U.S.

The gift, one of the largest among a recent flurry of major donations to academic research institutions, will endow student scholarships, faculty posts and public-health research, with a goal of improving America’s mediocre world ranking...