>>12665225If it's a bjt, you have to understand what a PN junction is. I hope you at least understand that.
A bjt has 3 terminals: base, collector and emitter. The base forms a pn junction with the emitter and it also forms one with the collector.
When the base is at a higher potential than the emitter a large electron current will flow from the emitter to the p silicon in an npn transistor. This is because the pn junction is forward biased. Now, if the collector is at a higher potential than the base then the on junction between them will be reverse biassed creating an large electric field. This field will suck up all the electrons in the p material so an electron current will flow from emitter to the collector.
This is a bit of a simplification. The other anons who were just calling it a switch probably don't know much about transistors. They can be used for analogue electronics as well as digital.