Plastic, insulating electrical boxes are used to safely house electrical connections, switches, receptacles, and other wiring devices in walls, ceilings, and sometimes outdoors. Their main purpose is to protect the wiring and the people using it.
Because they are nonconductive, plastic boxes do not carry electricity if a wire or terminal accidentally touches the box. This reduces the risk of electric shock and short circuits. They are especially useful in homes and light commercial work where grounding through the box is not required.
They also provide a secure enclosure for wire splices and device mounting, keeping connections organized and shielding them from dust, moisture, and physical damage. Many plastic boxes are lightweight, easy to cut, and simple to install, which makes them popular for new construction and remodeling.
Plastic boxes are commonly used with nonmetallic cable systems, such as NM cable, since they do not need separate grounding to the box itself. They can be made in many shapes and sizes for single switches, duplex outlets, ceiling fans, and junctions.
In short, plastic/insulating electrical boxes are used to contain electrical wiring safely, reduce shock hazards, simplify installation, and protect electrical connections in residential and similar low-to-moderate duty applications.