Question: How a CAN transceiver detects the 5 successive high or low bits and inserting the opposite bit as stuff bit ?
what is the logic behind the bit stuffing process?. 

I am sure that, it's not handled in CAN driver software side.

Answer: 
Bit stuffing is on the interface, not the transceiver, like how there is also hardware in the interface to calculate the CRC and various other errors without ever having to touch the main processor, if it sees the successive bits, it inserts the inverted non data bit,

The transceiver remains just a level converter,
This is not happening in transceiver but in CAN module in microcontroller. I suppose it counts bits, it's simple.