I would counter by asking why believing in a god implies optimism? I would argue there are several cults or small religious sects which believe in no afterlife and/or consider the future to be grim. Take Mormonism or Jehovah's Witnesses for example, who believe the rapture and end of the world is bound to happen any minute.
So perhaps we should rephrase the question to assume that believing in this god implies believing in a favorable afterlife and that humanity's future is a good one. In this case why should one we be atheist, or agnostic for that matter? Because a god is not necessary to justify a morality. The morals we have are reasoned, more or less, and therefore have some foundation. In the case of a theist, this foundation is likely a god. However, for an atheist or agnostic, this may be something equally spiritual, such as nature or intuition, or possibly something along the lines of science/logic and the philosophy thereof. It's entirely arbitrary where your source of "moral axioms" come from, but they necessarily exist, whether it be because of a god or not.
One can argue some ultimate truth from which morals are built is much harder to define or articulate if it isn't a god. For example, why not murder anyone you dislike? Well, one may talk about self-preservation and laws and the punishments associated with breaking them, but that's a rather weak answer. More likely, one would simply say "Because I value the livelihood of others. "Why?" "Because they're human just like me and my empathy makes me value them." "Why does that matter?" "Well I don't know it just does man can you please leave me alone?" You get the idea.
The irony is that, while the atheist's morality is less logically "complete"(as it's foundation is unclear), the theist would be a hypocrite to claim that as a fault. Claiming the existence of some supreme being isn't very far-fetched, however there are several logical leaps taken to justify claiming qualities of this god and what they want from you. There is no information or logic to justify these claims and instead they're simply assumed. If you ask why one would assume them however, you'd find it's because the theist was raised to or reasoned they ought to or because it matched what they think of the world, etc.
And suddenly the moral foundation of the theist is just as unclear as that of the atheist's. When confronted with the same questions as the atheist, the theist has the same faults. "Why not murder whoever you dislike?" "Well God says not to." "Why do what God says?" "Because..." And you can see the same problem as before arises. At the root of it all is simply a fault of logic itself - infinite recursion and causality. The very fact that all logic is formed by if-then (causal) statements, suggests that all things come from somewhere; every "then" has an "if"; every "cause" has an "effect". This of course raises the issue of the "first cause", as of course the question of "what caused this" can be asked to any event, statement, or belief. Christianity claims their god to be the first cause, and that this solves the issue. Unfortunately however, simply calling it the first cause does not stop us from being able to ask "where does God come from?"; "What caused this?"
In my opinion, it's all rather arbitrary. It seems to me non-consequential whether your beliefs are founded in theism, atheism, or agnosticism, and instead the important thing is how it impacts your livelihood and that of others. Because, while the foundations of any morals are recursively undefined, I think nearly anyone can agree that the livelihood of ourselves and others is the most important thing there is.