Llewellyn and His Dog is a poem by W. R. Spencer, based on a 13th century Welsh myth associated with Beddgelert village, the name of which means "Gelert's Grave," in the Gwynedd region of northwestern Wales.

In the legend, Gelert was a magnificent hunting hound, "the flower of all his race," gifted by King John of England to Prince Llewellyn the Great of Gwynedd. When Llewellyn prepared to go hunting with his men and their large pack of hounds, he left his infant son in his tent at the camp, in a pile of furs, unsupervised.

During the hunt, the men and hounds give chase to many likely quarries, but each time the game eludes them, because Gelert is not present. Llewellyn is bothered by this and repeatedly sounds his horn to summon Gelert, until finally, in frustration, he returns to camp to look for his best dog.

On returning to camp, Llewellyn is greeted on the path by Gelert, who approaches him enthusiastically. Llewellyn is shocked to see that there is blood on Gelert's mouth, and he makes haste back to the tent, only to find that there is blood everywhere, and his child is not in the pile of furs where he had been sleeping. In grief and outrage, the prince draws his long hunting knife and stabs Gelert in the side. In the same moment, he hears his infant begin to cry, and he lifts an overturned table to find the infant on the tent floor in the shelter of the fallen furniture, and a dead wolf laying nearby covered in Gelert's bites.

The prince realizes his own error too late to save the hound who had protected his child. He buries the hound in a grave fit for noblemen, and he names the village for being the place where Gelert is lain to rest.

Ah! what was then Llewellyn's pain,
For now the truth was clear;
The gallant hound the wolf had slain,
To save Llewellyn's heir.

Vain, vain was all Llewellyn's woe;
"Best of thy kind, adieu!
The frantic deed which laid thee low
This heart shall ever rue!"

And now a gallant tomb they raise,
With costly sculpture decked;
And marbles, storied with his praise,
Poor Gelert's bones protect.

Here never could the spearman pass,
Or forester, unmoved;
Here oft the tear-besprinkled grass
Llewellyn's sorrow proved.

And here he hung his horn and spear,
And there, as evening fell,
In fancy's ear he oft would hear
Poor Gelert's dying yell.

The song uses an Aarne-Thompson story type 178A, related to The Brahmin and the Mongoose, the legend of Saint Guinefort, and The King and His Hawk, all "faithful hound" stories cautioning against rash action and venting one's fear and wrath on one's loyal companions.

The story has also been covered by several other poets and storytellers, such as Richard Henry Horne, Walter Richard Cassels, and Francis Orray Ticknor.

Beddgelert does have mounded earth and a Welsh-English bilingual stone marker for Gelert's grave, detailing the story, but historians are not particularly convinced that Gelert ever actually existed.