Developmental biology is a huge field that we are still working on a lot.
DNA is only half the story. The other half is gene expression; what subset of the DNA a cell is using at any time. Your lung cells have the gene for insulin, but in lung cells, that gene is dormant.
The short answer is that in general, a mature cell is using the subset of its DNA that it needs to do its job and can't just change its gene expression to become a different kind of cell. Cells that do become less like adult cells and less specialized can become cancerous.