The Stay Puft Marshmallow Man was originally the vessel used by Gozer the Destructor to destroy the world in Ghostbusters but became a ghost in its own right shortly afterwards (despite having been blasted in the film), and also appears in the Ghostbusters video game. He appears as the secondary antagonist.
The Stay Puft Marshmallow Man has varied in the series from a villain to a hero but rarely displayed the same level of malevolence as it did in the original movie - perhaps due to the fact that it was no longer fully controlled by Gozer.
Role In Ghostbusters (original film)
The Stay Puft Marshmallow Man was formed during the climax of the original Ghostbusters movie in which the destroyer-god known as Gozer decided to take the form of the first thing the Ghostbusters thought of to destroy their world - despite the group making an effort to clear their thoughts, after Peter mentioned that if for example they thought of J. Edgar Hoover, he would come down to destroy everyone, Ray couldn't help himself from thinking of the one thing he felt could never possibly harm them: namely the Stay Puft Marshmallow Man.
Gozer caught Ray's stray thoughts and formed a gigantic Stay Puft Marshmallow Man by which to terrorize New York - this giant Stay Puft Marshmallow Man would proceed to climb the skyscraper the Ghostbusters were on in an attempt to reach them: proving itself durable despite taking heavy damage from the group's photon-packs.
In the end, Egon decides the only way to defeat the Stay Puft Marshmallow Man is to "cross the streams" - which risked a cataclysmic explosion but surprisingly Egon's gamble paid off and the resulting explosion was strong enough to destroy the Stay Puft Marshmallow Man while not causing a cataclysm (though it did result in a river of molten marshmallow raining down on the streets below as well as a parachute sized sailor hat floating down).
Role In Ghostbusters Series
Due to the Stay Puft Marshmallow Man's extreme popularity with fans and his iconic status he was destined to return in the Ghostbusters cartoon series - though this version of Stay Puft was much more benevolent than the movie version, in fact the cartoon version of the Stay Puft Marshmallow Man was often a heroic figure rather than an antagonist: though there were a few exceptions to this rule where the Stay Puft Marshmallow Man was back to his usual villainous ways.
The opening credits of the Real Ghostbusters showed the Stay Puft Marshmallow Man as a central figure amongst the horde of ghosts that were promptly "busted" by the group - this version of Stay Puft was shown as rather menacing despite the fact he was rarely a villain in the actual show (as mentioned above).