> why does piano have 88 keys?
I'm only ok at music theory, so I might get bits somewhat wrong, but the gist is right.
Notes with wavelengths that are integer multiples/fractions of each other sound the same. 440 Hz sounds similar to 220 Hz and 880 Hz (and this makes sense if you just look at the waveform), so we give them the same name. Western music slices the range between ω and 2ω into 12 points evenly divided along a log scale (we call this an octave). The log scale means the relationship of nearby notes is always the same; it takes an exponentially growing scale (frequency) and makes it linear.
You said 7 have names, but there are 12 notes in an octave. You'll learn more about that difference with scales, but the short answer most western music won't use all 12 notes because, for a given key; a specific subset of 7 sound a lot better together than the others.
88 keys is somewhat arbitrary, and there are pianos with more or less. What's important is how many and which octaves the piano covers.
Why is it called an octave when it has 7 named notes? I guess so we can repeat the first one and drive home the 2ω relationship.