What is this component called and how can I use it in a sketch?

That's a potentiometer:

The "103" on top marks it as a 10k (10 kilo-ohms) potentiometer. You can use it to set a variable voltage into the Arduino, and use that voltage to control something else that's variable (speed of a motor, brightness of an LED, etc.)

Have a look at the AnalogInOutSerial sample sketch in the Arduino GUI (File->Examples->Analog->AnalogInOutSerial)

--
The Flexible MIDI Shield: MIDI IN/OUT, stacking headers, your choice of I/O pins