At the neuromuscular junction between motor neurons and muscle tissue, the motor neurons release a chemical called acetylcholine which triggers the muscle tissue to contract. When the motor neuron is damaged or recieves abnormal signals (e.g. from a nerve being pinched) it releases more acetylcholine than usual which causes the muscle cells near the junction to clench without releasing, forming a contraction knot known as a trigger point. A cluster of these contractions is called a trigger point complex and forms what we think of as a muscle knot.
Here's a fascinating video explaining this from the perspective of treating trigger points with dry needling:
edit: here's a paper that nicely summarizes the topic and goes into detail about the concept of different kinds of "locus" within the trigger point complex that correlate to symptoms of tenderness: