Freeze spray typically contains a mixture of volatile substances, either HFC-134a or HFO-1234ze refrigerants, which have a very low boiling point. When the spray is applied to electronic components or circuits, it rapidly evaporates and absorbs heat from the surrounding area. This causes an instant drop in temperature, effectively cooling down the targeted components.
For more details, check out "Using Freeze Spray to Diagnose Faulty Electronics".