When we look inside a diode, we see it consists of a P layer and an N layer. To create a transistor, we need three layers. We have two possible combinations: N-P-N and P-N-P. Hence the names NPN and PNP transistor.
An NPN transistor looks like this:
Please note that the P layer between the two N layers is very thin. Just 2 micron or so.
Let's connect an NPN transistor to some voltage sources:
When VBE = 0V, there will be no current flow between C and E, since the CB diode is reverse biased.
When we increase VBE, electrons will flow from E through the N layer and the P layer to B. As we have noticed, the P layer is very thin. In no time the electrons flowing from B to E will have filled all the holes in the P layer. The remaining electrons will be free electrons. The P layer now appears to be an N layer. N type silicon always contains free electrons, so there is now a conductive path from C to E! If IBE increases, the number of free electrons increases and so will ICE. And that is how a bipolar transistor works.