As a simpler analogy, different devices act differently. A microcontroller and most ICs are like small smart water pumps. They pull a small amount of water (current) needed and only that.
Leds on the other hand, are like dumb industrial strength vacuums. Connect it to a power source, and it will try to suck as much current as it can as fast as it can. That's why you need a resistor. A resistor is like a small pipe. It only lets so much current through due to it's size. It resists more than that current from going through. The led wants to pull as much as it can, but only the 25ma or so that you chose, gets through.
As for the why you need a resistor when both the led and the output pin are rated for 25ma, is because these are recommended current, not maximum or possible currents. A led works best at 25ma for (a trade off on brightness and how long it will last in thousands of hours), but can be driven by less current (not as bright, lasts longer) or higher current (brighter, doesn't last as long). Too little current and it won't turn on. Too much, and it will eventually burn out.
The output pin of your microcontroller is the same, but as a power source. Ideally, you only want to source 25ma of current from that pin (and this is without getting into total current from all pins, or voltage sag). 25ma in this case is the recommended operational current. You can source less as well. It's good practice to only source as much as you need for a given setup. You can source more as well. Most datasheets will list a maximum voltage and current for a given output pin. (For example, 25ma recommended, 40ma maximum). But because current is pulled, not pushed, you have to make sure that what you are building takes that into account. For signaling or communication between your microcontroller and a ic, there is probably no need since both will be designed not to pull too much current. But if you are hooking up a current hungry led, or transistor, or motor, etc, then you need that small pipe, a resistor, to make sure you keep it below the 40ma maximum.
Finally, just as a note, the power supply you are using works in the same exact way. Hook up something that draws more than the recommended/maximum 2A, and it will fry and break (or pop a fuse or go into a reset mode depending on how quality it is). Hook up a 2 amp high current led directly to it without a current limiting resistor, and both will not be happy. HTH.