How transistor acts as a light switch?

All transistors are reactive to light. If you cut the top off of a regular PNP or NPN transistor and expose it to a sufficient amount of light, a current will conduct through any two of its leads. If you want to use it as a switch that turns on when it's night, you could attach the output to an inverter and then put the transistor up against a window. I guess when it got dark, it would conduct electricity...