What does a transistor do?

Depending on how the transistor is biased and various other circuits connected to it, a transistor acts as an amplifier and/or switch.
When acting as an amplifier the circuit containing the transistor can do things like transmit or receive radio signals, perform analog mathematical calculations, generate waveforms, etc.
When acting as a switch the circuit containing the transistor can do things like turn on/off a light, turn on/off a motor, perform digital logic or mathematical operations, fetch and decode computer instructions, etc.
Exactly what a transistor can do is really only limited by the system requirements and the designer's imagination as to how to meet those requirements.
There are several different types of transistors: bipolar junction transistors (BJTs), field effect transistors (FETs), unijunction transistors (UJTs), programmable unijunction transistors (PUJTs), spacitors, surface barrier transistors (SBTs), tetrode transistors (TTs), point contact transistors (PCTs), etc.