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.
If you lasthit a tower, you will get more gold, but none of it will be reliable, not even the global reward!
(This is no longer true since the 6.78 patch. Everyone on the team gets the same amount of reliable gold, and if a hero's lasthit finished that tower, he gets extra gold. So tower lasthits will be more worthwhile).
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.8 seconds.
Abilities that give gold (thanks to Samthere for mentioning them):