A circular piece of DNA that can replicate in a bacteria is called a plasmid. This is the BioBrick plasmid.
The lego brick is your DNA "part", the gene or element that you want to splice. It is flanked by sequences of DNA that can be recognized by restriction enzymes. These enzymes cut the DNA the same way every time. Let's say you want to put your orange part in front of your blue part.
First, you would cut both plasmids with restriction enzymes. You cut the orange plasmid with EcoRI and SpeI, getting rid of the rest of the plasmid. This is your insert. You cut the blue plasmid with EcoRI and XbaI, opening a space in the plasmid in front of the blue part. This is your vector.
Now you mix together your insert and your vector with a special enzyme called a ligase that can join to broken pieces of DNA. Because A's always pair with T's and G's always pair with C's, the overhanging edges of single-stranded DNA that your restriction enzymes left behind will match up to make double stranded DNA.
The EcoRI cuts will match up with each other, remaking the original sequence that can be cut by EcoRI again. Notice what happens at the junction of XbaI and SpeI. The overhanging single stranded DNA is complementary, matching up to make complete double stranded DNA. But the sequence of the matched up strands now doesn't match the SpeI or the XbaI restriction enzyme recognition sites. This "scar" can't be cut anymore, and your plasmid is ready to go through another round of BioBrick splicing as a composite part.