Can a housing society give notice to any bachelor visitor to vacate the premise?

I am a bachelor living in a society in Sector 62, Noida and I am a working professional. Recently one of my female friend came to visit me on weekend around 5pm and the society supervisor called me and said the girl is not allowed to stay inside the apartment and she needs to leave immediately. Is it legal for the society to do so? Upon asking the society president the reason why are such rules implemented and why is opposite gender visitors not allowed for tenants? He stated ‘People like you are polluting our culture, I cannot allow this. Either you tell her to evict right now or there will be consequences that I don’t want to do’. I have all documents including rent agreement and police verification. I have always paid the rent and society maintenance on time and in advance. What are my rights as a tenant and what rules does a society have to restrict opposite gender visitors to stay in my apartment if we both agree to stay? Can a society terminate my rent agreement? What should I do? Please help.