I heard an intresting argument once, I think it was on Planet Money or Freakanomics, that argued that early personal computer advertising had a major role. Early on it was a career or maybe a video game. In the early 80s when home systems like the C64 and TRS-80 were hitting the market they were marketed, essentially, as toys for boys.
So people bought them for their kids.
Their male kids.
Fast forward 10 years and the comp sci demographics shift.
After begging my parents for months, I was given a Commodore 64 for Christmas in 1982 when I was 10 years old. My two sisters never had any interest in it despite my constant attempts to get them to use it with me.
There's also the aspect, that I seldom see mentioned, that being a "nerd" was considered unattractive/uncool in the 80s (in part because of movies like "Revenge of the Nerds").
So people bought them for their kids.
Their male kids.
Fast forward 10 years and the comp sci demographics shift.