Before Islam, Afghanistan had many people who followed different religions such as Buddhism and Hinduism. Just like you have a favorite toy, these people had their own favorite gods and goddesses they would worship.
Some of these gods and goddesses were shared by both Hindus and Buddhists. For example, they both believed in Ganesh, the elephant-headed god, and Vishnu, the preserver god.
Buddhists believed in the teachings of Buddha who taught them to be kind and peaceful to everyone. They believed in the cycle of life, death, and rebirth, and tried to achieve Nirvana which is a state of perfect peace and happiness.
Hindus believed in different gods and goddesses that represent different aspects of life such as love, wisdom, strength, and wealth. They believed in karma, which means if you do good things, good things will happen to you, and if you do bad things, bad things will happen to you.
In Afghanistan, there were many temples and ancient structures related to these religions. Many of them were destroyed over time, but some are still standing today.
When Islam came to Afghanistan, many people converted to the new religion, but some still follow their old beliefs. Today, Afghanistan is a mix of different religions, languages, and cultures.