An elegy is a poem of mourning or serious reflection, usually about someone who has died. A eulogy is a speech of praise, most often delivered at a funeral. An elegy is written and mournful; a eulogy is spoken and praising — and a eulogy need not be about the dead at all.
The core difference
Both are associated with funerals, which is why they get swapped, but they are different forms.
- elegy — a mournful poem: Gray's Elegy Written in a Country Churchyard.
- eulogy — a speech of praise, usually at a funeral.
The roots
Eulogy is from Greek eu (good) plus logos (speech) — literally good words, and the eu- is the giveaway, as in euphemism and euphoria. Elegy is from elegos, a mournful poem or song.
A distinction worth noting
A eulogy can praise the living — a retirement tribute is a eulogy in the strict sense. An elegy is essentially always about loss. So the mood is the reliable divider: praise versus grief, rather than spoken versus written.