1. He is reading a book at the library.

2. He is reading a book next to the library.
3. He is reading a book in the library.
[What does #1 mean? Does #1 mean #2 or #3? Or does #1 mean both?]

For some reason I can't explain, 1 and 3 mean the same thing.

2 means that he is reading outside the library, maybe sitting or standing next to the wall of the building.

In this context, sentence #1, "He is reading a book at the library," typically means that someone is inside the library reading a book. It implies that the person is physically present inside the library building while engaged in reading. So, #1 would correspond to #3, "He is reading a book in the library." The preposition "at" in this sentence suggests a location, indicating that the person is reading within the library premises. On the other hand, sentence #2, "He is reading a book next to the library," means that the person is positioned near or beside the library, but not inside the actual building. Therefore, #1 is closer in meaning to #3 rather than #2.