If the friend was confused because the gender expression or body looked like "she" and the trans man hadn't introduced himself beforehand, then it was just a mistake. It's not crazy that someone accidentally misgender based on gender perceptions, we all gender people in our heads based on what we see and hear, but that doesn't mean it's always 100% accurate.
So the answer to "how was I supposed to know" is: you don't, unless you ask or are corrected. You can ask, but without further clues I also think it can be OK to assume someone's gender, we all do it all the time, and it's OK to make an honest mistake like that sometimes, as long as you're willing to respect someone's self-identity once they disclose it, and earnestly try to use the pronouns they provide.
If they want more resources on this, it might be helpful to point them to the Gender Dysphoria Bible for some 101 level info, and Julia Serano's books, particularly Whipping Girl and Sexed Up, for more exploration of gender and trans identity.