Will a paper in A help PhD application in B? I understand that as an undergraduate student, when you apply for a PhD degree in the US, you have to demonstrate adequate research capabilities, such as publications. But will areas matter? 

Let's say that a undergraduate student Q has been working on a networking project and she published a paper about that work. But Q is applying for PhD study in human-computer interaction. Will that paper help Q in getting the HCI PhD she wants?
Yes.

Admissions committees are looking for evidence of research potential.  Having a research publication in any area is direct evidence of that potential.

(One of the first hurdles that I encourage my own PhD students to jump early is publish something.  Anything.  The point is for them to see the publication process — writing, editing, submitting, reading reviews, revising, resubmitting — and to kill off any doubts in their minds that they can do publishable research.)