The no-third-term tradition originated when George Washington was President of the United States. He stated that two terms were more than enough for any president. This ended up becoming an unofficial law.
Washington's unofficial tradition was broken for the first time in 1940. Franklin D. Roosevelt, who led the country through the Great Depression, served for four terms in total. He was the only president of the United States that served more than two terms.
In 1947, following President Roosevelt's death a few months into his fourth term, Congress enacted the 22nd Amendment, which formally made the no-third-term tradition into a law.