How does something get its color?

The way light bounces off the object. Each color in the spectrum has a different wavelength, not unlike each musical note frequency. White light was all wavelengths, so it has all colors. When the white light hits an object that looks red, all colors are being absorbed except red, which is what you see being reflected back to the person looking at it. Something that's black absorbs all wavelengths, that's why black cars or clothes are so much hotter in sunlight.

Technically it is the angle of the electron in orbit that leaves when it is excited by the light. Different elements from the periodic table have different atomic weights (numbers) and different rings of electron orbits. Each ring has a different angle of the electron that is leaving when it is excited by light, and that angle corresponds to the color of the light that you see being reflected.