It depends on how old the lyrics writer was and what environment they belonged. It depends on the financial state of them. I think they are not so rich.
Furthermore, it depends on where they lived.
If they were students and had to spend the whole day at home during the summer vacation, it might be expensive to use the A/C whole day long. Their parents would not allow it, although it is not likely these days. Going outside to a beach or a mountain seems fun but very hot. If they have to do their homework, a library might be a perfect place. If they only have to kill time, a library might still be a perfect place. They can kill time all day long and it is completely free. No money is needed. If they go to a department store, they have to keep walking and would be tired. If they go to a family restaurant or McDonald's, they have to pay some money and they can't stay there more than a couple of hours. Young people would never think, but the elderly people would prevent to use the A/C in order to save money, and they sometimes even suffer from heat strokes these days. For this reason, I'd like to know how old the writer is or how old the parents of the writer are.
I don't know whether this is a particular Japanese culture or not, but a Japanese can think of the merit of a library with no difficulty.
Furthermore, in the west of Japan, seven o'clock in the evening in the summer is still light outside. Therefore, the location might be the east or the middle of Japan.
Hope this helps!