I have watched all of the Trigun series but for some reason I never understood the reason why Vash acts so happy. His backstory is really depressing but I don't think the series explained the reason for his happiness. I would think any normal person would be very dark but Vash is the opposite.
Vash acts happy because he chooses to act happy. More times than not, he is happy.
You're right when it comes to his backstory; it's not been a very easy life for him. Speaking about the anime chiefly, he's had to endure
him and Knives being found somewhere in space, and being treated like outcasts while aboard
...but the whole thing that ties everything together for him is Rem Saverem. She imparts to both Knives and Vash that there should always be a peaceful solution to every conflict which arises.
Knives rejects this philosophy, which - combined with
the physical abuse he suffered while aboard the ship
leads him down a fairly dark path. This is played with when Vash sees a spider and butterfly vying for survival; Knives put it almost as succinctly as, "Spiders eat butterflies to live. Saving one will cause harm to the other."
Vash does break on occasion; the tension between Rem's guidance and the stone-cold reality of life on Gunsmoke causes him to shoulder a lot of grief. Several examples include:
Towards the end of the series, after
he very nearly destroys the entire city of Augusta and puts a hole in the moon instead
he decides to recuse himself and live a quieter, more clumsy life for a short while.
The whole point of Legato Blues' existence is to cause Vash to suffer. Not to kill him, but to suffer. The methods which Legato uses are particularly brutal to accomplish this. Case in point: at one point, E.G. Mine, under direction of Legato,
is forced to throw his life in harm's way to kill a Plant that Vash was so desperately trying to save.
The final stand with Legato is also indicative of this dark past.
Legato gives Vash an ultimatum to either kill him or witness Milly and Meryl be shot dead. Ultimately Vash kills Legato, but this leaves him scarred until he can forgive himself and reconcile his choice with Rem.
There are other examples which almost always involve Legato's overarching goal to cause Vash to suffer, which involve friends or people he is close to.
In spite of all of this, Vash still desires to follow Rem's advice, and believe that everything can be resolved peacefully, and that no two people should ever attempt to kill one another.