When you walk on a woolen carpet and bring your finger near the metall

When you walk on a woolen carpet and bring your finger near the metallic handle of a door an electric shock is produced. This is because

charge is transferred from your body to the handle
a chemical reaction occurs when you touch the handle
the temperature of the human body is higher than that of the handle
the human body and the handle arrive at thermal equilibrium by the process
This question was previously asked in
UPSC NDA-1 – 2015
When you walk on a woolen carpet, friction between your shoes and the carpet causes charge separation, resulting in a build-up of static electric charge on your body (triboelectric effect). When you then touch a conductive object like a metallic door handle, this accumulated charge rapidly transfers from your body to the handle, creating a momentary electric current which you perceive as a shock.
Static electricity build-up due to friction and subsequent sudden discharge is the cause of the electric shock.
The amount of charge built up depends on factors like the materials involved, humidity, and the extent of friction. Metal handles are good conductors, facilitating the rapid discharge.