The conductivity of each tiny silicon transistor depends upon whether it is ‘doped’ with one type of foreign matter or the other! Silicon can be positive or p-type, the non-carrier of electric current or n-type having negative charge which is the carrier of current. The working of NPN transistor is shown in the accompanying diagram.
Perusal of the diagram will show that p-type silicon bearing number (1) does not permit the current to flow from the left-hand side to the right-hand side i.e. from (2) to (3) as if the door is shut to prevent its flow. Further assume that this p-type silicon is given very low voltage current by means of a thin wire (4). It opens up the closed door of p-type silicon allowing the electric current to flow through it which tantamount to registering of the digital 1. This process is taking place numerous times within a fraction of second in millions of transistors of a microchip.
Integrated circuit (Wikipedia)