This could happen in one of two ways: (a) Externalism: Your gender is determined by your society. (b) Internalism: Your gender is determined by yourself.