Biologically, a tomato is a fruit. This is inarguable fact. If you are a biologist breeding new strains, you will conceptualize a tomato as a fruit. And yet culinarily a tomato is a vegetable. Put a tomato in a fruit salad and people are going to look at you funny. Note that a biologist who eats food can and will consider a tomato both a fruit and a vegetable depending on the context.
If you can understand this, you can understand that someone’s biological sex—primarily relevant to reproduction and healthcare—can differ from their psychological sex (i.e., their gender), which is more relevant to social contexts. Both can be true simultaneously, but unless you’re a doctor caring for a trans person or intending to perform reproductive acts with them, someone’s psychological sex is almost certainly more relevant to your relationship with them than which gamete they happen excrete.