Social Security numbers are called Social Security numbers because were invented to implement the Social Security Act of 1935, which was one of the important programs adopted by Congress as part of the New Deal during the Great Depression.
These individual identifying numbers made it easier for the government to compile and collate information about the payroll taxes on the wages and salaries of workers potentially entitled to Social Security benefits which was (and is) collected by employers to pay for Social Security benefits.
Compiling this data was necessary because under the Act one's lifetime history of Social Security payroll taxation history is used to determine if you, or your dependents, are eligible for Social Security benefits at all, and if so, to determine how big the benefit check should be according to formulas adopted by the government agency administering the program.
This agency is now called the Social Security Administration. But, this agency has been relocated in the federal government bureaucracy now and then since the Act was passed in 1935 as part of general reorganizations of the federal government bureaucracy.
Keep in mind that all of this data collection and collation was done by hand. Computers adequate to assist government agencies in administering government programs wouldn't come into being for another thirty years.
The "security" referenced is the economic security that the Social Security Act of 1935 provided to elderly people, widows, and orphans. Before the Social Security Act was adopted, the elderly, widows, and orphans, who often lacked the ability to earn a living wage in the economic marketplace, routinely faced extremely high poverty rates, and employer survivor's and disability benefits were uncommon.
In time, Social Security numbers began to be used as a tool for the government to identify people for purposes other than administering the Social Security Act, such as for purposes of administering state and federal income taxes. But, by then, the name "Social Security number" for these identifying numbers originally used to administer the Social Security program was already firmly established.