Alliteration can be defined as the occurrence of the same letter or sound at the beginning of adjacent or closely connected words. A classic example would be the famous tongue-twister "She sells sea shells by the sea shore".
In the hands of a skillful writer, alliteration can be a very powerful literary tool, used mainly for emphasis. Once we see all those letters reoccurring so closely together we immediately take notice; our attention has been drawn to a particular sentence in the story that the author thinks especially important.
In "The Gift of the Magi" by O. Henry, there are a number of examples of alliteration. Early on in the story, right after Della glumly realizes she only has $1.87 with which to buy her husband Jim a Christmas gift, she throw herself in anguish down upon their shabby little couch:
So Della did it. Which instigates the moral reflection that life is made up of sobs, sniffles, and smiles, with sniffles predominating.
Henry uses alliteration here to draw our attention to the hopeless condition in which Della and Jim find themselves. This is especially important as their wretched poverty will determine what happens in the rest of the story.
Another example of alliteration is used to emphasize the general poverty of the neighborhood in which the Youngs live:
Della finished her cry and attended to her cheeks with the powder rag. She stood by the window and looked out dully at a grey cat walking a grey fence in a grey backyard.
Everything about the Youngs' life is grim and grey. So it is entirely appropriate that the cat that Della sees from her window is also grey, and that it should be walking along a grey fence in a grey neighborhood. This particular use of alliteration serves to highlight how Della and Jim are trapped by their poverty. Wherever Della looks, whether it's at the living room with its shabby furniture, or outside the window, she cannot escape the signs of penury that highlight just how poor she and Jim really are.