Long socks are a part of Japanese "Moe" culture and a common theme in the anime and manga world.
A bit of history!
Knee-high socks developed from "high socks" socks that covered up the calves. These were around since the 1980s and female idols wore them as part of their costume for their performance in television programs, and often coordinated with a mini skirt or short pants. Since 2006, knee-socks were introduced to the public as a fashion item that makes legs look thinner. Every fashion style in Japan incorporated knee-high socks to spice up the cuteness. Soon, the item itself was abbreviated as "Nii-hai" or "Nii-so" which made young females in Japan to be more familiar with it. From there, people have made different varieties according to their preferences and currently, there has been a set definition as for length for each type of knee-socks. "Knee-high socks" are considered to be about 40 to 50 centimeters long. “Over Knee-high socks” are 50 to 60 centimeters long. “Thigh-high socks” are over 60 centimeters long.
Why do people stick with "Knee High socks"?
There has been data collected from the male population who would consider that legs and thighs to be an important part of sexual attraction and since knee-high socks do emphasize those parts of the female body, it explains why that male population recognizes the attraction.
Then there's Zettai ryōiki
Ref: Why Can’t We All Stop Falling In Love With "Knee-High Socks"?