Three Apocalypses
I've recently read three hard science fiction tales set in near-present time, centered around an existential threat to Earth, and featured a desperate space flight to seek a salvation. Those three were The Hail Mary Project by Andy Weir, We Are Legion by Dennis Taylor, and The Calculating Stars by Mary Robinette Kowal. (Hail Mary and Calculating Stars are reviewed this month; We are Legion was reviewed last month.)
While the three stories share a theme and a structure of sorts, I was struck by their very different viewpoints on cooperating and competition. We Are Legion portrayed humanity as bickering, backstabbing competitors (rivals, bitter enemies) who would do anything to get themselves and their particular group off the dying Earth. The aliens all varied from suspicious up to xenocidally hostile. Practically the only decent person in the story was Bob (and he was narrating). In this story, the disaster was human-made, while it was an external event in the other two.
In Hail Mary, by contrast, the worldwide cooperation to find a solution is astonishing. Almost all interests (except the patent lawyers) are set aside to save humanity. Research is international, the crew is international, the launch vehicle is Russian. This is humanity at its finest.
Calculating Stars is somewhere between the extremes. Cold War differences are still present, to be set aside with difficulty. Race relations and gender differences keep some of the most talented people from contributing, holding back the effort. Slow advances are made on those issues throughout the series, but it's a work in progress just like today.
It's a choice we make, often unconsciously, as we create our characters and set our plots. Are people as a whole altruistic or selfish? Are they more often kind or cruel? I lean more towards the kind and altruistic myself, though if you don't have some of the opposite kinds, you don't have much conflict in your stories. Too often the real conflict is against inertia and apathy: "I can't save the world this week. I've got take the kids to soccer practice and then spend the evening doing my taxes."