Here is a video that illustrates how DNA gets all folded up in the nucleus (there is something like 3 meters (about 6 feet) of DNA stuffed inside a nucleus that might be about 10 microns across (1/100 of a millimeter (which is about 1/25 of an inch)) without getting tangled so individual chromosomes (long DNA molecules) can separate when the cell divides.
In have always found this intriguing.
The video makes it clear how this can happen: