Why would some people attend all girls' or all boys' university?
As a parent, there could be a lot of possible reasons why but most of the time it's the parent's decision, not the student.
Here are some of the reasons I can think of.
Religious belief - When parents have a strong religious belief, it's possible that they want their kids to avoid the opposite sex as early as possible to prevent them from being in a relationship at an early age or sometimes if they want their kids to be nuns or priest.
Avoiding scandals - Some parents, in order to avoid embarrassment of what their kids could have done is by changing schools especially to an all girls or all boys. This usually happens to girls who gets pregnant at an early age.
Better environment - It's also possible that the student are getting bullied from the original school, most likely by the opposite sex so parents would make them go to an all boys or all girls school to avoid this too.
Better education - I'm not sure if this applies to different countries too but here in the Philippines, all girls or all boys school tend to be a school of people with better lives which means poor people can't really afford it.