DNA fragments are cut out restriction enzymes (restriction endonucleases) and then joined together using enzymes called DNA ligases.
Restriction enzymes are enzymes which recognize target sequences (recognition sites) and cuts DNA at or near those sequences.
DNA ligase is an enzyme that connects the gap between the molecules (if they have matching ends).