The Sahabah are the best of the ummah after its Prophet, but they are not infallible
Question

There is a hadith where after the prayer، Prophet  got up and said ask me anything and I will answer so one of the companions got up and asked “Where will I be in the Hereafter?” and the Prophet (saw) said “In the Hellfire.” My question is who is this companion and how can one of the companions be in the Hellfire? Can you clarify this hadith?.
Praise be to Allah.Firstly: 
Al-Bukhaari (7294) and Muslim (2359) narrated from Anas ibn Malik that the Prophet (blessings and peace of Allah be upon him) went out and prayed when the sun passed the meridian, then when he said the salaam, he stood on the minbar and mentioned the Hour and momentous events that would occur ahead of it. Then he said: “Whoever would like to ask about anything, let him ask about it, for by Allah, you will not ask me about anything but I shall tell you of it so long as I am standing here.” Anas said: The people wept a great deal and the Messenger of Allah (blessings and peace of Allah be upon him) said repeatedly: Ask me. Anas said: A man stood up and said: Where will I be, O Messenger of Allah? He said: In the Fire. ‘Abd-Allah ibn Hudhaafah stood up and said: Who is my father, O Messenger of Allah? He said: Your father is Hudhaafah. Then he kept saying, Ask me, ask me. ‘Umar knelt up and said: We are content with Allah as our Lord, Islam as our religion and Muhammad (blessings and peace of Allah be upon him) as our Messenger. Then the Messenger of Allah (blessings and peace of Allah be upon him) fell silent when ‘Umar said that. Then the Messenger of Allah (blessings and peace of Allah be upon him) said: “By the One in Whose hand is my soul, Paradise and Hell were shown to me just now in this garden whilst I was praying, and I have never seen anything of good or evil like I have seen today.” 
As for the name of that man who asked about where he would be and the Prophet (blessings and peace of Allah be upon him) said that he would be in the Fire, al-Haafiz Ibn Hajar (may Allah have mercy on him) said: 
I did not find the name of this man in any of the reports; it is as if they omitted it deliberately so as to conceal him. al-Tabaraani narrated from the hadeeth of Abu Firaas al-Aslami a similar report and added: A man asked him: Will I be in Paradise? He said: In Paradise. And I did not find the name of this other man either. End quote. 
This is in addition to the fact that there is no interest to be served in finding out the exact name of this person who asked, and there is no adverse effect on one’s religious commitment if one does not know it. Hence no report of this hadeeth gives this information. 
Secondly: 
With regard to this questioner entering the Fire even though he was one of the Sahabah, there may be three reasons: 
1.
It may be that he was one of the hypocrites and Allah, may He be exalted, informed His Prophet (blessings and peace of Allah be upon him) of his situation. 
At the time of the Prophet (blessings and peace of Allah be upon him) there were a number of the hypocrites who used to pray with him and fast and worship Allah outwardly, but in fact they were hypocrites. Allah says (interpretation of the meaning):
“And among the bedouins round about you, some are hypocrites, and so are some among the people of Al-Madinah, who persist in hypocrisy; you (O Muhammad SAW) know them not, We know them. We shall punish them twice, and thereafter they shall be brought back to a great (horrible) torment” [Al-Tawbah 9:101]. 
2.
It may be that he will enter the Fire because of a sin that he committed, then Allah will save him from it and he will enter Paradise by the grace and mercy of Allah. 
3.
It may be that what is meant is that he will be in the Fire if Allah does not forgive him, and so he comes under the will of Allah. But perhaps the last two possibilities are more likely, and this is possible according to the principle of Ahl al-Sunnah concerning sinners among those who affirm the Oneness of Allah 
Al-Bukhaari (3074) narrated that ‘Abd-Allah ibn ‘Amr (may Allah be pleased with him) said: A man called Kirkirah was in charge of the luggage of the Prophet (blessings and peace of Allah be upon him) and he died. The Messenger of Allah (blessings and peace of Allah be upon him) said: “He is in the Fire.” They went and looked at him and they found an abayah that he had stolen from the war booty.
Muslim (114) narrated a similar report from the hadeeth of ‘Umar (may Allah be pleased with him). 
Al-Haafiz Ibn Hajar (may Allah have mercy on him) said: 
The words “He is in the Fire” mean he is being punished for his sins, or what is meant is that he will be in the Fire if Allah does not forgive him. End quote. 
Thirdly: 
The Sahabah (may Allah be pleased with them) were human beings and some of them committed sins and make mistakes, but on the whole they are the best of mankind after the Prophets and Messengers, and they are the best of generations, and all of them are trustworthy and of good character according to the consensus of the Muslims. But, also according to consensus, they were not infallible and free from sin, and with regard to what was narrated about some of them having committed a sin or having been warned about committing a sin, we should think of them in the best manner with regard to that and understand that this does not mean that he is not of good character or that Allah is not pleased with him. 
Rather Abu Muhammad Ibn Hazm (may Allah have mercy on him) said: 
All the Sahabah are definitively people of Paradise. Allah, may He be exalted, says (interpretation of the meaning):
“Not equal among you are those who spent and fought before the conquering (of Makkah with those among you who did so later). Such are higher in degree than those who spent and fought afterwards. But to all, Allâh has promised the best (reward)” [Al-Hadeed 57:10]
“Verily those for whom the good has preceded from Us, they will be removed far therefrom (Hell)” [Al-Anbiya’ 21:101]. 
And it is proven that all of them are among the people of Paradise. End quote. 
Quoted from him by al-Ameer al-San‘aani in Tawdeeh al-Afkaar li Ma‘aani Tanqeeh al-Anzaar, 2/245 
What we advise you to do is not to indulge in such matters; rather you should affirm the virtue of the virtuous. We testify to their goodness and righteousness, and we refrain from indulging in speaking about them without knowledge; rather we should focus on our own selves. 
See also the answer to question no. 13713. 
And Allah knows best.