Question regarding transgender


This is going to seem like a weird question or maybe make me seem really ignorant. So I am posing the question here rather than asking my personal friends so I dont get blasted or start a debate. But I have heard a lot about how "sex is different from gender", specifically regarding transgender people. Please offer any explanations or logical reasoning to this particular phrase. To me, they have the same meaning, so it is hard for me to understand. Please know I am not criticizing, just seeking to understand more about this. TIA for the the explanations.