Punk/Hardcore:
Anti-social "angry" type attitude, lyrics with a social commentary (usually anti-establishment), guitars are just a wall of noise behind the vocals, the vocals are nasal or angry screaming in hardcore punk, and punk bands are against the whole over-the-top rock n roll thing and claim to be more about musical integrity.
Heavy Metal:
Escapist attitude (rock n roll spirit in 80s metal), lyrics are about fantasy/escapism, guitars are the highlight of the music with songs being driven by catchy riffs, guitar solos being a standout aspect of the songs, vocals melodic and powerful except in the extreme styles, image usually important with hair/leather/etc.. being a big part of metal, big rock n roll stage shows (when the bands are big enough to afford it).
Of course there are exceptions, for instance thrash metal usually has socially conscious lyrics and aggressive screamed vocals, however thrash metal actually is known to be a hybrid of heavy metal and hardcore punk (Metallica, Slayer, Anthrax and Megadeth are all big fans of early punk).
Oh, and also the comparison between metal and punk also helps my argument that "nu-metal" isn't metal too, because every aspect of nu-metal is exactly the same as hardcore punk, it just has a few hip hop (vocals, bass, drums) and metal influences (heaviness in the guitar) mixed in.