I’ve had similar experiences, being a genuinely open and friendly person. It’s even worse where I live when being courteous is perceived as a come-on. Urgh, it’s so frustrating.
The social environment is easier to navigate as there is less at stake by shutting down, but within the professional environment when colleagues/bosses think it’s ok to harbour and express misconceived notions of you based on envy or patriarchy is unfair and malicious at worst. I’ve been asked about my sex life as a single woman which is totally unacceptable.
I’ve learnt to tone down my outwardly positive demeanor in order to navigate that. It’s just easier. Would be interested to hear how you have dealt with it.