The term “transgender” should not be understood to be merely “identifying with the opposite of one’s biological sex”. (Indeed, as pointed out, “biological sex” is not simply XY or XX, and can be XXY or XYY, etc.)
Being “transgender” can include intersex conditions, where the intersex person has the aforementioned chromosomal irregularities, or hormonal irregularities such as androgen insensitivity syndrome, congenital adrenal hyperplasia, etc. though the intersex community is beginning to define itself as more than being merely/only “transgender”.