Bangladesh is Muslim because of the Bengal Jagir (fief) being the personal plaything of many Turkic colonial dynasties when the Muslim Sultanates were first setting themselves up in India. In the east there was no hereditary Rajput warrior caste to speak of and Bihar had been on a constant decline ever since the fall of the Gupta golden age, Pataliputra went from the premier city in north India to the middling town of Patna. The Palas tried to halt it to their best of efforts but could not get Bengal and Bihar out of the economic collapse (as the two regions were quote linked at the time).
Another thing to note was the end of the pearl trade that was so valuable for the Sena rulers and much of Bengal. With the conquest of much of North India by Turks, pearls from Gujarat and further south could no longer make its way to the land and likewise Gujarat suffered a small economic setback when the sugarcanes from Bengal could no longer reach them. This terrible commodity situation led to the fall of the Senas and the rise of much poverty and warlordism in the area.
When the Qutbuddin Aibak set his generals loose upon all lands east of Prayaga it was the most zealous of them all, Mohammed bin Bakhtiyar Khilji who answered the call. He set forth and easily bowled over all resistance the local warlords could show and by 1198 had sacked Nalanda which in result sealed the death blow for mainstream Buddhism in the mainland sub-continent. Nalanda was already starting to wither as a university-town but could easily have lasted another century or so before Khilji destroyed vital records that held the history of the ancient sub-continent.
Khilji instantly set about converting the locals, quite often by sword due to his reported zealous nature but that wasn't the only reason people converted. Bengal is a massive watershed and one of the most fertile regions in the world due to it's ashen soil and frequent flooding. However with economic collapse and a reported string of famines according to Al-Biruni which probably lasted till after his visit, the crops were failing and many devout Buddhists and Hindus were forced to eat their cattle. Conversion to Islam meant that they could do this with all livestock and help alleviate their hunger with moral justification.
By the 1300s Buddhism had almost disappeared from the area and three dynasties from Delhi had practically given free reign to their governors of Bengal, many of whom were hereditary kinsmen that had no experience actually administrating the provinces they ruled and Bengal practically be became a poor and forgotten backwater. The only way to rise high was to be Muslim, inspiring many conversions but even the Turkic upper-class was extremely racist and refused entry of the locals to many forms of government.
It was not until Farlhuddin Shah, a minor governor did this start turning around and it was only with the rise of Shamsuddin Ilyas Shahi did Bengal's fortunes change and syncretisation begin. Ilyas Shah adopted Indo-Aryan customs and properly acclimatised the local rulership and began a more meritocratic system. It took Bengal nearly a hundred years more to actually get on par with the nation's to their west.
After the Ilyas Shahi dynasty failed Raja Ganesha, a feudal Hindu lord took control of Bengal and continued its economic rise but his son converted to Islam when he realised all of the upper nobility and half of the lower nobility was Muslim and if the dynasty was to survive it needed to change to the times.
Sher Shah Suri and the Mughals also allowed Bengal to its own devices from its governors but by the late 1600s suncretization was done and half of Bengal was Muslim. When the Nawab's took power most of them were not of the religious type but conversion continued and that lasted all the way until the British took Calcutta and established their Presidency.
Partition also has a massive role to play in the fact why Bangladesh is Muslim. Whereas before 1947 village communities would often be 60/40 like they were through out the rest of the Indo-Gangetic belt, the biggest forced migration in the history of the human species changed that. But the end of Partition a lot of Hindus moved out of Bangladesh into West Bengal, the Indian state and many Muslims had to migrate the other way.
Why did Buddhism,die out?
Well the rise of the Hinduism as we know it was starting and especially Vaishnavism and Kali worship allowed the consumption of meat to an extent that Buddhism simply didn't as said above there were many rampant famines in medieval Bengal. Also theGupta revival and classical Golden Age left the Buddhist university of Nalanda slightly neglected in favour of the more western and scientific university of Taxila before that too fell apart.
So when pressure was felt from the west by foreign invaders, the incapability of the Buddhist lower and upper nobility in the rest of the North was a sort-of domino effect and it was even felt in Bengal. However the lack of a Rajput warrior society in the east also meant that there was no real shield against invaders and thus the ahimsa that was taught in Buddhism was simply not viable anymore like it had been in classical times. And once Nalanda went down in flames any knowledge that might have helped Buddhisms survival also went away.
However it is important to note that even prior to the Muslim invasions there was already a Shinto-Buddhist relationship between Hinduism and Buddhism and they really were not separate faiths. People used to pray to their local animistic deities that would fall under the umbrella of Hinduism when they went about their daily life and when in times of death and birth Buddhism offered them solace and understanding.