No, sex isn't defined by chromosomes, although in humans they usually determine the sex of the person (determine in the sense of causing it to be).
So the presence of the Y chromosome doesn't necessarily indicate maleness.
(In some reptiles, it's not chromosomes that determine the sex of the foetus - it's the temperature at which the egg incubates that determines whether it will develop as male or as female.)
Sex is defined by which type of gamete a person produces, or potentially could produce if their reproductive system functions correctly. A person with Swyer syndrome has a female reproductive system, but without fully functioning ovaries. So they are female.
Sex is defined by gametes. Chromosomes usually determine sex, but sometimes things go wrong, as in the case of someone with Swyer syndrome. The Y chromosome doesn't mean they are female. So the presence of a Y chromosome doesn't indicate malenes. Someone with Swyer syndrome is female, as described in articles like these:
" Women with Swyer syndrome do not produce eggs (ova), but if they have a uterus, they may be able to become pregnant with a donated egg or embryo."
https://medlineplus.gov/genetics/condition/swyer-syndrome/#:~:text=People%20with%20Swyer%20syndrome%20have,and%20contain%20little%20gonadal%20tissue.
"Girls with Swyer syndrome have an XY chromosomal makeup (as boys normally do) instead of an XX chromosomal makeup (as girls normally do)."
https://rarediseases.org/rare-diseases/swyer-syndrome/
This article explains the difference between what defines sex (gametes), and what determines it (usually chromosomes, in humans).
https://www.theparadoxinstitute.com/read/defining-sex-vs-determining-sex?rq=definition%20of%20sex