This question is one of the core questions in biology that many thousands of biologists are trying to answer. Although we have made huge progress since DNA was discovered there is still a lot that isn't known in the area of gene expression, which is what forms the basis of the answer to this question. So every cell in the body has the same DNA code, which you can imagine as an instruction book for how to be a cell. If we compare a cell to a worker in a big company then there are many aspects of being a worker that are the same for everyone, for example every worker needs to know how to commute to work or use a computer so they must all read the chapters of the instruction book for these tasks. Likewise, every cell must "read" (the scientific word is "express") the genes needed to move proteins around a cell or to release energy in respiration for example. However, some workers in the company have special jobs such as being in the IT team and this is true for cells in the body too. For example, immune cells in the blood must be able to recognise pathogens and therefore must express the genes needed for the receptors to recognise them.This then leads to the question of how each cell can express different genes. This is very complicated but it relies on interactions between proteins in the cell and the DNA itself. Transcription factors are a type of protein that can interact with the DNA in specific places and, therefore, activate the expression of certain genes - they guide the cell to the pages of the instruction book that they need to read. A more recent discovery is the field of epigenetics, which studies how it is not just the DNA but also the chemical marks on the DNA that affects which genes are expressed. This is a bit like a cell leaving post-it notes on the instruction book with corrections and modifications but without the words actually changing. The amazing thing is that the cell has the ability to change, remove and add post-it notes constantly and can even pass them on to the daughter cells produced in cell division. These are two very general explanations of how cells can express different genes and, therefore, how cells manage to differ despite having the same DNA. If you would like to know more then we can go into it in further detail!