Note first that Hajj is not obligatory except on those who are able to perform it. This includes physical and financial ability. But if a person is given a donation through a lawful channel, then it becomes his own property and he can use it for Hajj. This consequently means that a person can give some money as a gift to another so that he can use it to afford Hajj.
Dr. Marawan Shahin, Professor of Hadith and Its Sciences, Faculty of Usul Ad-Din (Theology), Al-Azhar University states: It is generally allowed for a Muslim to offer his brother a gift. It is moreover a commendable act. The Prophet (peace and blessings be upon him) said: “Exchange presents so that you would exchange love.” The only condition in this case, when someone pays for the Hajj of another as a gift, is that it should be from halal (lawful) money. Actually, a sum taken as a gift is acquired through a halal channel of gaining, and thus there is nothing wrong with it, especially if the person who offered it is known for his honesty and trustworthiness. Therefore, a sister can give her brother the costs of Hajj as a gift, in the same way she can perform Hajj on his behalf if he is physically unable to do it himself.

In this concern, Sheikh Hasanin Makhluf, the late former Grand Mufti of Egypt (may Allah bless his soul) stated:

When Allah made Hajj obligatory, He made the ability to afford it an essential condition for that obligation. Hence, Hajj is not obliged except on those who can afford it. The exact ability to perform Hajj and to prepare oneself for it is not precisely dictated in the Shari`ah. What is really important is that such ability be acquired through lawful channels. So, as long as financial ability is attained through lawful means, there is nothing in Shari`ah to prevent one from performing Hajj from the donated money or the gifts that one receives. This applies whether financial ability is accomplished through work, donation, gift or else. So, there is nothing wrong in performing Hajj with donated money, according to the Islamic Shari`ah.
Also, it is permissible to perform Hajj, fard or nafl (obligatory or supererogatory) out of the money gained as a prize, even if it is intended as some kind of support so that he can perform Hajj with it. Hence, a prize or a donated sum transfers to the ownership of the donee as soon as he takes hold of it, so he can use it as he wishes. The evidence on this is the incident of Barirah; she was given some meat in charity. Then she gave it as a gift to `A’ishah, the Mother of the Believers (may Allah be pleased with her). `A’ishah cooked the meat but did not present it to the Prophet (peace and blessings be upon him), thinking that the Prophet would not eat from it, as it was a charity. But the Prophet (peace and blessings be upon him) said: “It is a charity on her part, but a present on ours.” Then he ate from it.