In the story, the Swallow is on his way to Egypt to spend the winter; he stops to spend the night in the city, and that is where he meets the Happy Prince.
The Prince begs the Swallow to stay with him for one night and to act as his messenger. The Swallow agrees and proceeds to carry a ruby from the Prince's sword to a seamstress who lives in the city. The gift of the ruby will allow the impoverished woman to purchase some oranges for her sickly son.
As winter approaches, the Swallow runs more errands for the Prince. One by one, the Prince gives away all the precious jewels that adorn his figure. Finally, the days become too cold for the swallow; he begs to join his swallow companions in Egypt, where they will sleep the winter away in the temple of Baalbec. However, the Prince requests that the Swallow complete one last errand for him before he leaves: to give away the second of his sapphire eyes. The sapphire eye will go to a little match-girl whose father will beat her if she does not bring home some money.
The Swallow completes this last errand but subsequently refuses to leave the Prince. He stays because the Prince is now blind and can no longer see. Because of the Prince's great compassion towards the poor, the Swallow cannot bear to leave his kind friend in the hour of his need; he has come to love the Prince and to admire his generous nature too much to desert him. The Swallow runs one last errand for the Prince before he dies; he carries every leaf of gold that covers the Prince's body to all the poor in the city. The Prince's sacrificial nature has inspired the Swallow to sacrifice his own comfort and life for the greater good.
In the end, the Swallow dies at the feet of the Prince he has loved and served so faithfully in the space of one winter.