The story
Late 16th century, from earlier heyda (1520s), as exclamation; compare hey, hei and Swedish hej då. Sense “period of success, vigor” is a reanalysis as heyday based on unrelated day (as “period of time”) – compare day in the sun.
Etymology from Wiktionary, CC BY-SA 4.0.