Does it hurt my chances with B since B knows that I'm interning at A
and (very likely) there's a possibility that A will offer me a
fulltime job after the internship?
Perhaps, but maybe not.
Companies don't want to go through a long, time-consuming interview and offer process with candidates who they believe aren't interested.
How should I answer if HR/an interviewer asks me about that
Whenever I've interviewed candidates who were in the middle of a current internship, I've always asked about it. I ask how it is going, what the intern likes and doesn't like about the internship, etc.
I always ask "What do you plan to do if you are offered a full-time position by the company where you are currently interned?"
Depending on the answer (both verbal and non-verbal clues) I try to determine if my company is a serious landing spot, or just a "safety" in case the internship company doesn't come through. If the latter, I might suggest that the candidate get back to me once their internship company decides one way or the other. If I need to fill the position quickly, I might expand my search for candidates.
You should consider this in your dealings with company B. If you are at the point of an offer, they will most likely want to feel sure that you won't accept and then change your mind if an offer from company A becomes reality.
If you would prefer to work for company A, your best bet is to be honest with company B and let them know. If you are an attractive enough candidate, and if the situation is right in company B, they may be willing to hold their decision until company A decides. Or they may not.
And if you think company A is on the verge of making you an offer as well, you may want to chat with them and let them know that time is of the essence.
Either way, you don't want to lie to company B, or accept their offer only to reneg later. That would be a terrible way to start your professional career, and could damage your reputation.
If you would prefer to work from company B, then simply make it clear that you are not seeking any offers from company A, and that no matter what A's counter-offer, you want to work for B.
You just need to convince the interviewers that you are sincere. If company A comes up, you must answer the questions directly. Otherwise, don't even bring up the possibility that company A might make you an offer.
Be ready to make a decision, without waiting for A. Go in knowing what want, and what you are willing to settle for. You don't want to play games here (like trying to play A off of B), or you risk raising doubt and losing an offer.
It's pretty powerful to be able to say "If we can get together on the details of the offer, I'm ready to say 'Yes' right now!"