"Tommies" refers to "Tommy Atkins," a generic representative name used for British soldiers to indicate where they should sign on their paperwork. However, "Tommy Atkins'" exact origins are murky, dating back to 1743 in a letter that referred to the conduct of the original "Tommy Atkins."
The most popular theory behind "Tommy Atkins" is that the Duke of Wellington chose the name for soldiers in 1843, but paperwork shows that the War Office had officially begun using the generic name in 1815. Rudyard Kipling's poems helped popularize the term, eventually replacing the "Thomas Lobster," a reference to the red uniforms of British soldiers. However, the term was not always popular or positive; during World War I, British soldiers disliked being called "tommies" and used it derisively, imitating the jingoistic language of certain newspapers.
Despite having been thoroughly debunked, the story of the Duke of Wellington remains prominent in popular consciousness. Folklore states that during his first command, the Duke of Wellington came across a dying soldier who managed to communicate that he was named Thomas Atkins. Before dying, the mythological private gasps out that he was just doing a day's work, immortalizing himself in the mind of the Duke of Wellington, who recalled this scene in 1815 when asked for suggestions on a generic name that represents the brave men of England's army.