As widows son has stated, they started out as a charitable military organization. They were essentially a travelers aid society. They gained several very wealthy patrons and were eventually exempted from all taxation. This meant that they had excellent equipment and resources. So, in addition to their charitable work, they became the elite shock attack forces of the Crusades. Due to their reputation, they also were hired to maintain estates while the owner was on Crusade. In addition, they developed a letter of credit system that made travel far easier.
However, once the Crusaders got kicked out, their reason to exist had simply disappeared, but like all large organizations, they refused to dissolve or consolidate. Instead, they became merchants and bankers with international immunity to taxation and immunity to all local laws (another benefit held over from the Crusade era). Finally, they lent a lot of money to monarchs. That's a dangerous thing when the "government" still consists of a bunch of tough guys who got the job merely through accident of birth. The violent destruction of the Templars may have been inevitable. Imagine how our own government would respond to a bunch of highly-trained, well-armed, battle-hardened men leading an enormous network of farmers, construction workers, factory workers, bureaucrats, etc., all immune to the law and unable to be taxed--plus the government owes billions to them. They aren't a state, so they don't have an actual territory or traditional standing as a country. They're a "paramilitary organization" with a hand around the government's throat (massive loans). I can't think of a government in all of history that wouldn't cook up an excuse to take such a group down.
So, yes, they did start out as the "Poor Knights of the Temple", risking their own lives so others, no matter how poor, could safely travel and worship. But their success took that away from them.