A transistor is the now-ubiquitous device used to control (i.e. switch), and also possibly amplify, signals in an electronic system. It replaced an earlier generation of technology which performed the same function, vacuum tubes. They are made out of semiconductors, solid materials that are intermediate between conductors (such as metals) and insulators in their ability to carry electicity.
A transistor generally has two inputs and an output: one input where the main signal (or power) comes in, another input which controls the electrical flow through the transistor, and an output where the main signal flows out. Specialized transistors can have more.
The first transistors were individually packaged; some transistors (particularly those used for power systems) are still produced in this format. However, the physical nature of transistors allows them to be made very small, and technology was developed to allow creating more than one transistor on a single piece of semiconductor, the integrated circuit (IC).
Over time, the technology of making transistors on ICs smaller has improved to where the number of transistors in which can be included in a single IC has grown to almost unbelievable levels, such that the largest modern ICs can contain more than a billion transistors. At the same time, the speed of operation has increased, and the power used has decreased.
The transistor, especially in its IC form, has utterly changed the technological face of societies world-wide.
The first transistor design to reach mass production was the 'bipolar junction transistor', which can amplify a current flow. Its two inputs and an output are the 'collector' (where the main current flows in), the 'base' (an input which controls the current flow through the transistor), and the 'emitter' (where the main current flows out).
Another transistor design, theorized in the 1920s, but not actually constructed until after the bipolar transistor, was the 'field effect transistor', which can use a voltage to control current flow. Its two inputs and an output are the 'source' (where the main current flows in), the 'gate' (an input which controls the current flow through the transistor), and the 'drain' (where the main current flows out).
The latter type is now the kind used in most ICs, implemented in CMOS.