What happened in that episode? I've only seen a dozen or so episodes in full.
On the eve of his twentieth anniversary as school principal, Seymour Skinner is lured by his mother to Springfield Elementary School for a surprise party. The celebration goes well until a strange man arrives, claiming to be the real Seymour Skinner. Principal Skinner admits that he is an impostor, and that his real name is Armin Tamzarian. Armin then tells the story of the events that led him to steal Seymour Skinner's identity.
Armin was once a troubled young man from Capital City who enlisted in the Army in order to avoid a jail sentence for petty crimes. There, he met and befriended the real Sergeant Seymour Skinner, who became his mentor and helped him find meaning in his troubled life. Seymour told Armin that his dream was to become an elementary school principal after the war. Later, Seymour was declared missing and presumed dead. Armin took the news of the apparent death to Seymour's mother, Agnes. Upon meeting him, however, Agnes mistook him for her son, and Armin could not bear to deliver the message. He instead allowed Agnes to call him Seymour, and took over Seymour's life. Meanwhile, the real Seymour Skinner spent five years in a POW camp, then worked in a Chinese sweatshop for two decades until it was shut down by the United Nations.
After these revelations, the people of Springfield begin to distrust Armin. Armin decides that there is no longer any place for him in Springfield. The real Skinner is then offered the chance to realize his dream and take over as school principal. He takes the job, but the real Skinner finds himself isolated by the townspeople, who realize they prefer Armin to him. Armin, however, has already left Springfield and gone to Capital City to resume his old persona as a no-good street thug.
Marge heads to Capital City with Edna Krabappel, Agnes and the rest of the Simpson family. After Agnes orders Armin to return home, Homer persuades Mayor Quimby and all the other citizens to allow Armin to resume his assumed identity as Principal Skinner. The real Skinner is unhappy about this and refuses to give up his job and his dignity just because the people of Springfield prefer Armin to him. In response, the townspeople banish the real Skinner from town by tying him to a chair on a flatcar of a freight train (literally running him out of town on a rail). Judge Snyder declares that Armin will again be referred to as Seymour Skinner, that he will return to his job as school principal, and that no one shall ever again refer to Skinner or the fallout from his visit, under penalty of torture.