Most Lego pieces have two basic components -- studs on top and tubes on the inside. A brick's studs are slightly bigger than the space between the tubes and the walls. When you press the bricks together, the studs push the walls out and the tubes in. The material is resilient and wants to hold its original shape, so the walls and tubes press back against the studs. Friction also plays a role, preventing the two bricks from sliding apart. This uses an -- a firm, friction-based connection between two parts without the use of an additional fastener.