Vikings didn't wear horned helmets. The horns came from 19th-century opera.
The horned Viking helmet is one of history's most recognisable images, and there's no evidence for it. Viking Age texts mention helmets but never horns, and the helmets found have none. The idea took off in the 1800s, largely thanks to the staging of Richard Wagner's Norse operas.
Contemporary sources from the Viking Age talk about helmets often, but never describe horned ones. Even Christian writers who were keen to portray Vikings as barbaric did not mention horns. The few helmets from the period that archaeologists have found have no horns; they resemble the earlier 'spectacle' helmets of the Vendel period, with protective guards around the eyes. The helmets described in the Old English poem Beowulf also fit that hornless style.
The association is modern. It began in the 19th century and was popularised by productions of Richard Wagner's operas on Norse themes, which put horns and wings on Viking helmets. The image stuck because it is visually striking, and it has survived repeated debunking by historians and archaeologists. Most historians think that if horned headgear existed in the Viking Age at all, it was not worn regularly.
Horned helmets were real, just not Viking. In Denmark, the Veksø helmets, a bronze pair from around 1100 to 900 BC, were found in 1942, some two thousand years before the Viking Age began. The Waterloo Helmet, a Celtic ceremonial piece from about 150 to 50 BC, was pulled from the River Thames in London. Germanic soldiers in horned helmets appear on the Arch of Constantine in Rome, dedicated in AD 315, and small figures in horned headgear appear on Migration Period objects such as plates from the Sutton Hoo helmet. Some scholars think those later figures show gods or ritual dancers rather than real battle gear.
Beyond Europe, horns signalled power. In ancient Mesopotamia horned headgear marked gods and kings, and more horns meant greater importance. In Japan some samurai helmets carried horns, sometimes real water buffalo horn, to help identify commanders on the battlefield. The Vikings are simply the one group everyone pictures wearing them, and the one with the least evidence.
Source: Wikipedia — Horned helmet · Text summarised from Wikipedia (CC BY-SA 4.0)