There are two sexes. People have a sex. Gender is the assignment of a sex to an inanimate object for grammatical purposes. i.e. a ship is a she.
People have a sex; objects have a gender.
Inanimate has nothing to do with it. A boy is masculine. A girl is feminine, usually. (In German a young girl is neuter.)
ML/NJ