As the oil works through the engine, it heats up to over 200 degrees and cools once your vehicle turns off. This constant heating and cooling cycle cause the oil to darken. This darkened color may look dirty, but it does not in itself mean the oil is bad or dirty.
In diesel engines, some exhaust gasses always get into the crankcase and bring with them soot. Since diesel does not burn as cleanly as gasoline, this soot makes its way into the oil. This is why diesel oil is usually a dark black color when you change it.