X-rays are usually produced by electronic transitions within atoms, whereas gamma rays are released from an atom's nucleus during radioactive decay.