england-and-wales
Regarding the question in the headline:
Generally the business or venue organisers can set the rules for who is allowed entry and service, provided there is no discrimination based on a 'protected characteristic' in the Equality Act.
There can be a 'dress code' and entry can be refused to people who are not dressed to code. For example the dress code could be "business formal", "business casual", "smart casual", "evening dress", "sexy but classy", "no trainers". There can be guidance about what those mean for men and women respectively.
A dress code may have different specific requirements for men and women respectively so long as they are of generally similar standard and strictness/leniency.
The dress code can say that "smart clothing for men means shirt and tie" so long as the rule for women is of a similar standard. But a rule such as "women must wear high heels and tiny skirts" is likely to be unlawful.
For employers, see the government's guidance Dress codes and sex discrimination – what you need to know. Nevertheless, there have been anecdotes about employers that require women to wear heels, make-up and skirts above the knee.
The scenario in the question body, relating to the man wearing a shirt incorrectly and told to wear it incorrectly, does not seem to engage anti-discrimination law. The scenario has no information that the man is told to wear his shirt correctly because he is a man.
However, if the men are treated differently on the grounds of their sex, then that's unlawful. E.g. if women are wearing shirts tied up to expose their stomachs and men doing the same are told not to do that, ejected or refused entry, because they are men, then on the face of it the men are being treated unlawfully.
There don't seem to be any legal proceedings or news articles etc related to that context.
In the employment context there have been several cases, including that of Nicola Thorp, a temp sent home without pay for refusing to wear high heels at work in 2016. It seems neither her agency employer nor its client had a justification for why it was necessary for her to wear high heels to do her job. This resulted in a petition that led in turn to a Parliamentary committee's inquiry, High heels and workplace dress codes (see also the Government's response).
Also in 2016, British Airways' female cabin crew won the right to wear trousers after a two year dispute.
From discussion in the question's comments here, the question seems to be in essence,
"is it unlawful discrimination for a venue to turn away males for wearing a particular kind of clothing item but allow entry to females wearing the same kind of clothing item?"
"would the business or venue get away with it because of social or cultural norms?"
On the face of it is unlawful discrimination if the clothing requirements are different standards. Again though we can only speculate as to whether it would be found unlawful unless there are cases that I am not aware of.
However, night-time venues commonly have ladies nights, which is plainly direct discrimination based on sex*, so why wouldn't they get away some clothing-based sex discrimination?
In summary then, yes it seems to be unlawful discrimination but in practice the business can nevertheless do it while people discriminated against do not challenge the business. This is also true for the employment context - after Thorp became headline news, numerous women told similar stories.
* Equality and Human Rights Commission guidance says, "An advert that restricts goods, facilities and services to a particular group is unlawful except in very limited circumstances" and "Adverts for hotels, restaurants, nightclubs, pubs and recreation centres giving preferential treatment to a particular group, for example an advert stating that women have free entry into a nightclub [might be unlawfully discriminatory]"