Cobra-la was a race of super-humans who once ruled the world, but they retreated to hide from the ice age. By the time they decided to emerge, humans had developed spears and arrows, so the cowards decided to stay hidden.
Cobra Commander was a weak runt by their standards, but he survived due to his intellect. They put him to work in bioweapons, and a mishap ruined his face. His people "rewarded him" by giving him the job of "Go conquer humanity", but that was more likely just a pretense for his banishment into the icy wasteland.
Using nothing more than his mind and his charisma and his leadership, Cobra Commander created a military organization capable of ruling the world, and very nearly accomplished that goal on dozens of occasions, but yeah, he never quite managed to stick the landing.
Then his organization turned against him, crediting themselves for their victories and him for their failures, although they recognized that none of them could step up and replace him, so they decided to create a superhuman to replace Cobra Commander (retconned by the movie to suggest that the coup was initiated by Cobra-la, who wanted to seize control over the impressive military organization Cobra Commander created).
In his own self defense, Cobra Commander screwed Serpentor, sticking him with the mind of a pro wrestler rather than the greatest strategic mind in human history. And then he secured his #2 position by telling Serpentor outright that he would need a scapegoat, someone to blame for his many, many failures (of which there were easily as many as Cobra experienced under Cobra Commander).
After Cobra-la/Serpentor led Cobra on a failed mission against GI Joe, Cobra Commander saved his forces by moving them into range of Cobra-la, an action which he knew to be not in his own personal interest (he was personally terrified of Cobra-la, but he brought Cobra there anyways, to save them from a crushing defeat that was not of his making).
Cobra-la, playing up their role as the true head of Cobra, put Cobra Commander on a sham trial, groundlessly accusing him of incompetence, and then slowly and cruelly stripped him of his mind and his humanity. But Cobra Commander had the last laugh, because he betrayed the bastards and provided vital intel to GI Joe, allowing GI Joe to destroy Cobra-la.
And then at the start of the next season, he recovered from being turned into a mindless animal (his people realized that they were lost without him) and he got his revenge against Serpentor, turning him into a mindless animal, and regained control over what was left of his organization.
An episode of Transformers revealed that the organization called Cobra did eventually fade away, but Cobra Commander lived on to old age, and in retirement he successfully tangled with the Autobots and got away clean, while he has a low opinion of the quality of so-called "terrorists" these days.