I'm not actually familiar with modern American unit nicknames, but it does seem somewhat similar.
During the Principate, legions typically had a name and a number. This number was assigned when the legion was raised and was never changed, and wasn't entirely logical. This means you had several 10th legions, and a whole lot of 1st legions.
Most of these legions acquired a name and/or various titles as well, which could be based on:
Some of these names and numbers had their origins in the final years of the republic, for example with the legions who served Caesar. The practice can't have been much older than that, though, since in Republican times legions would only serve for specific wars and campaigns and would then be disbanded, which precluded the formation of strong and lasting unit identities.
All evidence suggests that in Imperial times, Roman legionaries took great pride in their unit's history and designations, and were disdainful of other units. Soldiers who left inscriptions would usually mention their legion, for example.
If you want to know more, check out this list on livius.org, which not only has all known legions of the Principate and some later units on it, but also includes short (and sometimes not so short) histories of each of these units if you click on their names.
Source:
Adrian Goldsworthy, The Complete Roman Army (2003)