The way this works is a process called gene expression, and cell differentiation. There are many things we don't understand about cell division and development and this is one area that is still not well understood. It appears however, that there are parts of the DNA or the cytoplasm that tell the cell which parts to make when. Nobody knows for sure how this works. One thing to consider: now that the entire human genome is known--that is: we know the sequence of all the DNA in a human cell--we can tell that only 3% is used to actually code for the 30,000 proteins that together with water, lipids, ions, metals, and other molecules, make up all parts of living cells. So the question is: what does the other 97% of the DNA do? Maybe it is somehow involved in the questions you ask. Maybe it tells the cell when to change into another kind of cell, or when to stop making protein, or when to do different jobs, etc. The fact is: we just don't know. If you find this amazing, and you are looking for something to study for a career in science, this is a good one because the field is wide open.
making a small donation to science.ca.