"an upper chamber," c. 1300, an extended sense from late Old English loft "the sky; the sphere of the air," from Old Norse lopt (Scandinavian -pt- pronounced like -ft-) "air, sky," originally "upper story, loft, attic," from Proto-Germanic *luftuz "air, sky" (source also of Old English lyft, Dutch lucht, Old High German luft, German Luft, Gothic luftus "air").
If this is correct, the sense development would be from "loft, ceiling" to "sky, air." Buck suggests a further connection with Old High German louft "bark," louba "roof, attic," etc., with development from "bark" to "roof made of bark" to "ceiling," though this did not directly inform the meaning "air, sky" (compare lodge (n.)). But Watkins says this is "probably a separate Germanic root." Meaning "gallery in a church" first attested c. 1500. From 1520s as "apartment over a stable" used for hay storage, etc.