The devtas are not extortionists who want to extort money from you and if you don't give send you to hell.
Giving Dāna
Giving in Hindu tradition is called dāna. The tradition of dāna goes back to Rig Veda. Yajñāḥ is making offering to the Devas(often translated as 'sacrifice'). Usually dravya i.e grains, ghee, etc are offered through agni(fire). This was an act of gratitude to the pancha bhootas and the devas also a means for connection with the divine as a friend and a guide.
Dāna was not only given to the devas but also to those who are in need. Bhagavad Gita 17.20 - 17.22 talks about giving dāna(translations by Swami Mukundananda):
BG 17.20: Charity given to a worthy person simply because it is right
to give, without consideration of anything in return, at the proper
time and in the proper place, is stated to be in the mode of goodness.
BG 17.21: But charity given with reluctance, with the hope of a return
or in expectation of a reward, is said to be in the mode of passion.
BG 17.22: And that charity, which is given at the wrong place and
wrong time to unworthy persons, without showing respect, or with
contempt, is held to be of the nature of nescience.
Giving Dāna to Temples
Wikipedia entry on Dāna in historical records has a good description along with sources cited of why dāna is offered to temples:
Hindu temples served as charitable institutions. Burton Stein states
that South Indian temples collected donations (melvarum) from
devotees, during the Chola dynasty and Vijayanagara Empire periods in
1st millennium through first half of 2nd millennium AD. These dāna
were then used to feed people in distress as well as fund public
projects such as irrigation and land reclamation.
Even today despite the apathy of the 'secular' government of India which grabs the money collected from temples, most temples offer anna dāna(food offering) to the public.
Giving Dāna to Priests
Priests(pujaris/pundits) belong to the Brahmana varna. Dharmaśāstras(e.g. Manu Smriti 4-4:6, 4-7:8) prohibit them from owning property or earning income. They are supposed to live only by taking bhiksha(collecting alms by begging) from people. This was honored in the ancient times. In modern times, this system is almost non-existent. Giving money to the pujari is the modern equivalent of bhiksha. In times of need, the king used to provide to the pundits but in today's time the secular government excludes those of the Brahmana varna from most of social welfare schemes.
On a side note, dāna also plays a central role in Mahayana Buddhism where it is one of the 6 Pāramitās(perfections) to be achieved by a practitioner.