Melody is the primary, memorable tune—often carried by voice or lead instrument. Accompaniment provides harmonic and rhythmic support via chords, bass, percussion, etc.
Example: "Twinkle, Twinkle, Little Star"
Melody: vocal line
Accompaniment: piano chords (C, G, Am, F)
The two intertwine to create a cohesive musical texture.