Here's a very abbreviated overview to a vast literature of the end of times/apocalypse/technocaust/end of the world themes. This is just a short working list, really, and includes only short stories or novels. In many cases there is just one example (where there could be hundreds). There are no movies or television shows listed, though I think that they must be enormously outnumered (and the scale of orders of magniutue) by the print media.
Extraterrestrial Threat: When Worlds Collide by Philip Wylie, 1933
Human general malaise, dystopia, ennui: Arthur C. Clarke's Childhood's End ; City (1952) by Clifford D. Simak; Friday by Robert A. Heinlein;. Galápagos by Kurt Vonnegut.; Planet of the Apes by Pierre Boulle;l H. G. Wells' The Time Machine
Insect extermination: Charles Pellegrino’s Dust, 1998. The ecosystem collapses after bugs disappear.
Monsters: Skeletons, (1992) by Al Sarrantonio. The Earth is ravaged by a raised-from-the-dead society of super monsters comprising all animals that ever lived, ever, but in super-skeleton form. Yikes!
Nuclear weapons: too, too many to reckon with here. Ray Bradbury famously ends the world at the same instant via an exchange in Fahrenheit 451, for example. Mordecai Roshwald's Level 7, Nevil Shute's On the Beach and Pat Frank's Alas, Babylon,
Overpopulation and mass famine: Anthony Burgess’ The Wanting Seed 1962. Also 1966 novel Make Room! Make Room! by Harry Harrison (made into Soylent Green). The Handmaid's Tale, by Margaret Atwood, tale of developing underpopulation caused by infertility caused by pollution.
Robot Revenge/Overlords: Erewhon's section The Book of Machines (1872); The Machine Stops 1909,by E. M. Forster ; The Mind Machine (1919) by Michael Williams; R.U.R. (play, 1921), by Karel Čapek, The Metal Giants (1926), by Edmond Hamilton ; Automata (1926 short story) by S. Fowler Wright