What is it?
Cash is the most general resource in the game along with the wall damage. It is used to buy all buildings with the exception of Demon that costs 666 bricks to purchase. Necromancers, and Black Obliterators requires both cash, and specific types of bricks (regular bricks for Necromancers and fourth wall bricks for Black Obliterators). It's also used to buy most of all the upgrades of the game, with some exceptions that require other resources to buy them; for example, demon upgrades, which require bricks instead of cash.
How to obtain?
When you start the game for the very first time, just hit the wall (left click it), as for doing it, will grant you 1 cash, 1 wall damage and 1 hand damage (this latter one is just to see how much damage has been done to the wall by clicking it).
Anything that deals damage to the wall will make you gain cash by the amount of damage you dealed.