Spending Money Contrary to the intention of the Giver
Question

A relative of mine wanted to travel to look for work in another city, so his father and brothers collected money for him, then they gave it to him so that he could make use of it whilst travelling. When this relative saw me, he gave me a considerable amount of that money as a gift. 
Is it permissible for me to accept this money, even though I think it most likely that if they found out, they would be upset, because he gave this money for something other than what they intended, and some of them might be in greater need of this money? Or has the money become his property, so it is permissible for him to dispose of it however he wishes?
Praise be to Allah.If this money was given to this person for the purpose of travel – as appears to be the case from the question – then he does not have the right to spend it on anything else, or to give some of it to anyone, except with the permission of those who gave it to him.
Additionally, he must return whatever is left over of it, if there is anything left over.
However,  if the wealth was given to him as a gift or charity , and no specific purpose was stipulated for it to be spent on, or the gift was not given for any specific, apparent reason, then he has the right to spend it however he wishes.
It says in Asna Al-Matalib (2/479) by Shaykh Zakariyya Al-Ansari (may Allah have mercy on him):
“If he gives him money and says: Buy yourself a turban with it, or go to the public bath, and the like, then it must be used for that purpose, as the purpose was specified by the giver.
This applies if he intended that he should cover his head with the turban, or clean himself by going to the public bath, because he saw him bare-headed and looking unkempt and dirty.
Otherwise, if he did not mean that specific purpose – rather he said it by way of normal chatting – then it does not have to be spent in that particular way; the recipient may keep it and spend it however he wishes.”
Ad-Dardir (may Allah have mercy on him) said: 
“If a group of people or an individual help a Mukatab [a slave with a contract of manumission] to pay off that contract by giving him money and he paid it off, and there is some money left over, or he was unable to pay off his contract, then if the helpers did not intend to give the money as charity to the Mukatab – rather they intended only to free him from slavery, or they did not have any particular intention in mind – in that case, the helpers may take back the surplus amount, if they wish. Or, if the Mukatab is unable to manumit himself after giving their money to the master, they can go to the master and ask him for what this slave gave him of their money.
But if their aim was to give as charity the money that they gave to the Mukatab to help him, then they cannot take back the surplus or ask the master for what he received of money if the slave was unable to manumit himself, because the aim behind giving this charity was to help the slave and he became the rightful owner of this money as soon as he acquired it." (Ash-Sharh Al-Kabir, 4/404)
Based on that, you do not have the right to accept your friend’s gift when you are aware of the situation. You have to return the money to him and tell him what we said.
And Allah knows best.