The DNA wraps around the histones, which helps keep it organized, similar to how folding clothes keeps them neat, and allows it to fit inside a cell (in prokaryotes) or inside the nucleus (in eukaryotes).
When a cell is preparing to divide (through mitosis or meiosis, followed by cytokinesis), the DNA wraps more tightly around the histones than usual. This tighter wrapping causes the chromosomes to condense, meaning they become more compact and take up less space. Because of this, chromosomes become visible under a light microscope at this stage. At other times, they are not easily seen and cannot be clearly distinguished from the rest of the nucleus.