This is explained nicely on the Gold page of Dota 2 Wiki:
Gold can be split into two categories:
- Reliable gold – Any bounty you get from hero kills, Roshan, and global gold from towers is added to your reliable gold pool.
- Unreliable gold – Everything else (creep kills, neutrals, etc).
The difference between the two (except from how each is earned) is how
each one is spent:
- Dying can only take away gold from your unreliable gold pool and not from your reliable gold.
- Buying items uses up your unreliable gold first before using your reliable gold.
- Buyback uses reliable gold first.
In the end you still have a fixed amount of total gold (you just add
the two together).
The purpose of having these two categories is to encourage ganking and
tower kills that accumulate the reliable gold pool, which is gold that
cannot be lost from dying.
I tried to "research" this further by killing different things in a practice game.
You get reliable gold for killing an enemy hero. For killing Roshan everyone on your team gets 200 reliable gold. If an enemy tower is destroyed, everyone on your team gets reliable gold (and you get additional unreliable gold if you got the last hit on it).
Killing creeps or the courier gives you only unreliable gold.
At the start of the game you get unreliable gold, and then 1 unreliable gold every 0.6 seconds.
Abilities that give gold (thanks to Samthere for mentioning them):