The earliest cells, and all prokaryote cells, don’t have a nucleus. Inside these simple cells, the DNA molecules just float around in the cytoplasm. This is a nice simple arrangement, but it’s risky – the DNA often gets broken or damaged somehow.
About two billion years ago, some cells developed a lipid envelope that went around the DNA molecule and protected it from accidents. These cells were successful, and now all of the more complicated eukaryote cells have these protective envelopes. We call the envelope and the DNA inside it the nucleus of the cell. (This is not the same thing as the nucleus of an atom.) Some cells actually have lots of nuclei – some cells have thousands! To fit a lot of DNA inside a tiny cell, the DNA forms a spiral shape called a helix.
The DNA of the cell tells the rest of the cell what to do (though it also gets directions from other parts of the cell too). So you could think of the nucleus as the brain of the cell, or the government of the cell. When the cell needs to do something, the DNA molecules assemble smaller RNA molecules in specific patterns and send them floating out into the endoplasmic reticulum. There the RNA can assemble whatever other molecules the cell needs: the pattern of that RNA molecule decides what molecule it will assemble.
If you take the nucleus out of one cell and put it into a different cell, the new cell will follow the instructions of the new DNA and become like the old cell – this is how scientists do cloning.