Why doesn't my computer USB port break when I plug in a 2A device?
To be compatible with the original standard, USB devices should not draw more than 100mA (which is plenty to power the logic interface), until they have negotiated with the host, to find out what it can supply. After successful negotiation, they can draw up to 500mA. This is to protect the operation of a 4 port hub, should it be plugged into a PC with all its downstream devices already attached.

Not all USB devices are compliant to the standard, but just draw full current anyway, USB toys commonly do this. Most PCs provide 500mA anyway, so it all generally works.

Dumb power supplies generally hold their data lines in particular states, to signal to the device being charged that they are a power supply, with a certain capability. Later standard revisions allow USB-C and PCs higher currents, and higher voltages (eek!) to be negotiated.