All perfect praise be to Allaah, The Lord of the Worlds. I testify that there is none worthy of worship except Allaah, and that Muhammad is His slave and Messenger. We ask Allaah to exalt his mention as well as that of his family and all his companions.
The will of a person regarding the method of dying or any other matter could correspond to what Allaah has predestined, and it could be different from what Allaah has predestined. It is the decree of Allaah that is effective, not the will of the person. On one hand if Allaah has decreed for a person to die as a martyr, and the person wished to die as such, then his will corresponded to what Allaah has predestined for him. So he dies as a martyr, not because that was his will but it is because Allaah has decreed for him to die as such. On the other hand, if Allaah has decreed for a person to die on his bed, while his wish is to die as a martyr, then his will did not correspond to Allaah's decree so this person dies on his bed, because it is Allaah's decree that is dominant. Allaah says (interpretation of meaning): {And the Command of Allaah is a decree determined.}[33:38]. 'Meaning that the Decree of Allaah inevitably takes place, no one and nothing can change it or prevent it from happening; what Allaah wills takes place, and what Allaah does not will, will not take place.' [Interpretation of Ibn Katheer]
Many people wish something, but something contrary to their wish occurs. This is common and happens often. Allaah says (interpretation of meaning): {Indeed, We have created all things with predestination.}[54:49]. Allaah further says (interpretation of meaning): {And you do not will except that Allah wills.}[76:30]. However, Allaah with His Mercy and Grace, grants the person who sincerely asks Him to die as a martyr, the reward of a martyr even if he dies on his bed. The Prophet said: "Whoever, sincerely asks Allaah to cause him to die as a martyr, Allaah will give him the reward of a martyr even if he dies on his bed." [Muslim] To conclude, it is the Predestination of Allaah that inevitably happens whether or not the person had so wished.
Allaah knows best.