Lord Krishna in Bhagavad Gita says it is difficult for commoners, masses to visualize enormity of Brahman, God Almighty creator of present cosmos. To worship god, to pray to God religious practitioners devised ways and means and idol worship started in Hinduism.
The entire masses needed a means to an end, something visible they could pray to. God in Hinduism religion is worshipped in form of idols, even mountains and rivers were considered sacred. As the means available, accordingly the worship!
If a Hindu practitioner was so poor that one could not afford to go to a temple or there was no temple nearby then even a Banyan or a Neem tree was considered sacred. There had to be something that could be crystallized, only then they could pray to god.
In reality as per Bhagavad Gita God Almighty always was without a form (Nirakaar) and also without attributes (Nirguna).
Praying to Sakaar form of God (having a form) does not yield anything. Religious practitioners (following path of rituals) never reached God in their lifetime.
As per Bhagavad Gita, as a soul atman we are primarily a spirit having no form. Then how could our creator Brahman, God Almighty have a form!
As per Bhagavad Gita our human body is only a means to an end. Our soul atman, the spirit within manifested human form to work out its karma; remove dross impurities within. A soul atman indulges in cycle of birth and death until it reaches state of absolute purity. For a pure soul atman, the need to manifest human body any further ceases to exist.