Mentor trying to be first author?
I don't really understand what the motivation here for the professor is. Since you did all of the work for this paper at University B, you should not list your new affiliation (whether it's an internship or another school) as an "active" affiliation for this paper. It can be listed as a "current address," but not as an active address for this paper. In that way, the professor still gets credit for your work, with your affiliation showing as being part of his group. (I suspect that the professor's concern is that, if you are at another institution and list that as your address, he won't get credit for his work.)

Another issue is that if you are not going to present the paper at the conference, he may have felt it was in his interests to list himself as a first author. How appropriate this is I have to leave to the CS community to judge. 

In general, however, the first author should be the person who has made the largest contributions to both the research and the writing of the paper. Deviations from this need to have a very good foundation.