A basic example is green plants, the chlorophyll in the leaves absorbs the red and blue for energy and the green is reflected.
I googled and found this:
https://www.itp.uni-hannover.de/~zawischa/ITP/origins.html
Haven't gone though that page yet, but I'm pretty sure it has to do with the surface texture for the simple case of reflection, various atoms also absorb distinct narrow bands as the energy per photon has to be exactly right to bump an electron n shells further from the nucleus (like phinds said), and just the first few seconds of scanning that webpage shows it can get a lot more complicated than just simple "this makes it red, this makes it green, this makes it blue"