The best analogy for a transistor is a light switch.
Just as a light switch can turn a light on or off and control the flow of electricity to the light, a transistor can control the flow of electrical current in a circuit, acting as a switch or amplifier.