What is this device called
While I'm not 100% sure since it could be some rudimentary rotery encoder, it's almost certainly a potentiometer. The way you connect it to an led depends on what you want to do.