Gold is a resource that is used in the Alchemy Lab to research technologies. Gold is generated by taxing your kingdom's population. Contrary to the other resources in the game, gold is not protected by the Storehouse. Additionally, when a kingdom is attacked and defeated, only troops can plunder the gold -- supply units will not haul off gold.
There are two primary ways to generate gold: 1) by taxing your kingdom's population or 2) attacking rival players.
Generating gold via Tax: In the early stages of the game, particularly during the seven day Beginner Protection, taxing your kingdom's population is generally adequate for producing enough gold to meet your researching needs. To increase the gold generated from taxes, you can build/upgrade additional cottages and/or increase the tax rate slider under the Overview tab of your Castle. Note of caution: Tax Rate and Happiness have an inverse relationship; as your Tax Rate increases, your Kindom's Happiness will decrease. See Happiness for additional information.
Generating gold via Attacking other players: Once Beginner Protection ends and the player proceeds beyond the early stages of the game, attacking other players becomes the preferred method for obtaining gold. This is because 1) taxing proves inefficient at keeping up with the growing cost of researching new technologies and 2) opposing players will frequently attack and steal your gold, which makes it difficult build up your gold quantity. Since attacking a player will often result in a retaliatory counter-attack, it is generally wisest to only attack for gold if the plundered gold can be immediately spent on research.
Note: Generally speaking, it is considered poor form to attack the same player multiple times in one day, or for multiple consecutive days. Doing so will generally result in the victim's Alliance retaliating on his behalf.