According to The Phrase Finder, humble pie is
a play upon words which dates back to
the time of William the Conqueror. First, the pie referred to in
'eating humble pie' was really umble pie, made from the umbles -
heart, liver and gizzard - of a deer. It was made to be eaten by
servants and huntsmen, while the lord of the manor and his guests
dined on venison. Thus a person who had to eat umble pie was in
a position of inferiority -- one who had to humble himself before
his betters. The pun resulting from umble and humble is even more
precise when you recall that in several British dialects - notably
Cockney - the h in humble would be silent. Actually, the two words
come from quite different roots, humble from the Latin 'humilis'(low
or slight), and 'umbie' from the Latin 'lumulus'* (loin)."
*This should be lumbulus (OED)