Farmer Giles, or in full Ægidius Ahenobarbus Julius Agricola de Hammo, was the eponymous hero of the story, Farmer Giles of Ham. At the beginning of the tale Giles was but a farmer living in the Middle Kingdom but by the end he had become a hero, a defender against a giant, a tamer of the dragon Chrysophylax, and finally the king of the new Little Kingdom.
One fine summer night Giles was woken up by the cries of Garm, who warned him of a giant trespassing upon his property. Taking up his blunderbuss, the farmer fired his weapon (more or less by accident) at the face of the intruder, who turned around and went away (thinking he had been stung by a large fly). After getting up from where the recoil of the blunderbuss had laid him out, Giles found himself the Hero of the Countryside.
Eventually even the king of the Middle Kingdom in his capital (about twenty leagues distant from Ham) heard of Giles' deed. About three months after the incident the king sent Giles a testimonial letter on the feast of St. Michael. He also sent the farmer a gift, a plain heavy sword that had been hanging in the king's armoury from a time forgotten.
Giles was mightily pleased with his testimonial and gift, and felt that luck had smiled upon him. Then one winter's night Garm appeared with the alarming news that a dragon named Chrysophylax had come to the Middle Kingdom. At first the dragon was a comfortable distance away, but as he got closer and the king's knights did not appear, the folks of Ham began expecting Giles to save them. Giles hid his sword and tried to ignore his neighbors' pleas, but one night the parson stayed and insisted on seeing the sword. Once taken from the shelf the sword leapt from its sheath and refused to be put back in. The parson asked to take the sword and sheath home, in order to study the inscriptions on them, and got the farmer's ready consent.
The next day Giles learned that he was the owner of Caudimordax, the famous dragon-slaying sword. Soon, with much goading by the parson and the miller, as well as the rest of the village of Ham, Giles was off on his grey mare with his cowering dog, armed with a thrown-together suit of metal rings and Caudimordax.
Farmer Giles took Chrysophylax by surprise, or rather ran into him by surprise. As the dragon tried to make lunch out of Giles the sword Caudimordax took things into its own hands (so to speak). When Giles waved the sword, trying to shoo the dragon away, the sword managed to smite the dragon upon the joint of his right wing, thus depriving him of flight.
The victorious farmer chased Chrysophylax all the way into Ham to the village church. At this point the dragon surrendered and offered repayment for all damages if they would spare his life. After some haggling the dragon was allowed to leave, in order to fetch his hoard. While Giles watched, the parson made Chrysophylax swear solemn oaths to return.
After the wily dragon had broken his promise and King Augustus Bonifacius had been insulted by this breaking of a pledge, Giles was summoned to accompany the knights of the land in finding Chrysophylax. Giles rode with the resplendent warriors who all treated him as a peasant deserved. When the noisy cavalcade reached the mountains Giles' grey mare had become strategically lame and thus when the dragon attacked, they were not killed in the rush (that is the rush of the dragon upon the knights and the rush of the knights away from the dragon).
Once again the dragon was cowed by the resolute farmer and his mighty sword. Giles had Chrysophylax bring him to his lair and bring out a portion of his hoard. Cannily, Giles did not force Chrysophylax to impoverish himself (which would have provoked a real fight). As agreed, the dragon bore the loot upon his back as Chrysophylax, Giles, the grey mare, and Caudimordax marched back to civilized lands.
Giles picked up a half dozen of the servants of the run-away knights, who readily fell into his service when he promised to pay them well. When they reached a village another dozen likely lads were invited into Giles' group, for the farmer had begun to have ideas. Giles and his party went straight to Ham and he did not bother to report to the king.
When the enraged monarch rode to Ham with his remaining knights, Farmer Giles met them upon the bridge into the village. Sitting upon his grey mare with Garm and Caudimordax at hand Giles defied the king and demanded his crown! When the king tried to have Giles seized the dragon emerged from his hiding place beneath the bridge and put to rout all the king's horses and all the king's men. The king, alone, came back to the bridge but he could neither command the rebel farmer nor get him to fight in single combat.
After his victory Giles had Chrysophylax kept in the parson's tithe-barn. This earned him the title "Dominus de Domito Serpente" (or in the vulgar Lord of the Tame Worm). A lord Giles had become, but soon he advanced to Earl, and then to Prince, and finally to King in his own right. Giles was crowned as Ægidius Draconarius of the Little Kingdom but was known more often as Old Giles Worming.
Giles lived long and grew a great white beard down to his knees. He ruled a respectable court with a whole new order of knighthood (called the "Wormwardens"). He kept his luck and wits to the end of his days and proved to be a generous king.
 The Complete Genealogy of the Royal Household of the Little Kingdom