There is a pass in the mountains between what is now Afghanistan and what is now Pakistan known as the Khyber Pass. This would be the major invasion route into British India from either Persia (Iran) or from the Russian empire. Therefore, controlling the Khyber Pass was essential to the defense of India. The English only took control of most of the subcontinent in the mid-18th century, and they were paranoid about defending it ever after. When Napoleon invaded Egypt in 1798, the English became alarmed that it would be used as a base for an eventual invasion of India--and the English had only taken control of India by defeating both local leaders and the French.
Napoleon was probably never a serious threat to India. He made the gestures, but his mind was in Paris, where he was soon to take power in a
coup d'état. But the English remained paranoid about threats to India, and the Khyber pass loomed large in those paranoid fantasies, since an army which successfully issued from the Khyber Pass would have to be defeated in open battle, on its own terms. But if an enemy could be kept to the north and west of the Hindu Kush (the name for the mountains which separate Afghanistan from India, and which means "the slayer of Indians"), the defense of "the jewel in the imperial crown" would be a much simpler matter, and require far fewer troops.
This is what lead to the several Anglo-Afghan wars--the desire to defend India by holding Afghanistan. (The term "Afghani" is undoubtedly popular among ignorant journalists and those who think a google search will tell if a word is "correct" or not; traditionally, in English, the term for a resident of Afghanistan, and the combining form of that term is Afghan.) The first, and most disastrous took place in 1841-42. Major General William Elphinston was placed in command of an Anglo-Indian army of about 5,000, of whom about 7- or 800 were English, and the rest Indians from the Bengal Army. (Bengal is the name given to that part of India which is today Bangladesh and north-east India; the population of Bengal was largely Muslim, and the soldiers were experienced and highly reliable, so it was thought that they would be good troops to use in an invasion of Muslim Afghanistan.)
Elphinstone was past his prime, was indecisive and completely unprepared to deal with the wild political situation in Afghanistan. He accepted completely unacceptable terms in a futile attempt to avoid attacks by Afghan tribesmen, and began a retreat with his 5,000 troops and more than 10,000 families of the troops, camp followers and other hanger-on in January, 1842. It was one of the greatest catastrophes in military history. Very nearly the entire force with all of the family members and camp followers was wiped out, either dying in the snows of the Hindu Kush, or being slaughtered by the Afghans. A few prisoners were taken who were later released (Bengali soldiers) and a single English officer--a doctor, i believe--with a couple of Bengali soldiers managed to make his way back to British India.
Claims about drunkenness and drug abuse among the Afghan tribesmen are, i suspect, an example of actual fiction, arising in the perfervid imagination of a writer who wants to gild the lily by making an already horrendous account more lurid. I have no reason to assume that it is true. Have you been reading a
Flashman novel, or some similar tripe? The British introduced the cultivation of the opium poppy into Afghanistan in order to produce a crop to sell in China--and this would have been after 1842. Muslims are not supposed to take alcohol, and while it is silly to think that they never do, a claim about widespread drunkenness among the hill tribes of Afghanistan is even sillier.
From British Battles-dot-com, here is an account of the disastrous retreat from Kabul in 1842.
This was only the beginning. The English were determined to take and hold Afghanistan for strategic reasons, and there were to be many opportunities for the Afghans to slaughter the English and their Indian allies.