Nagilum was a very powerful extra-dimensional creature, which lived in a "hole in space", utterly devoid of all matter and energy in the Morgana Quadrant. This was in part, as an experiment during its encounter with USS Enterprise-D, in 2365.
In the course of conversations with the creature, it called Humans limited, apparently because they were mortal. It became increasingly interested in the concept of "death" and killed the ship's conn officer, Ensign Haskell simply to witness the effect on him. Further intrigued, it decided to study this aspect of humanity on numerous levels, proposing to kill off a large portion, from one third to one half, of the ship's crew.
Nagilum finally let the ship go after Captain Picard threatened to kill his entire crew, via the auto-destruct system, rather than to subject half of his crew to an experiment. In a final conversation with Picard, Nagilum revealed that he had learned everything that he needed and admitted that while quite different, he agreed with Picard that he/it perhaps shared the trait of curiosity with Humanity. (TNG: "Where Silence Has Lease")