Praise be to Allah.
Before starting any act of worship, the Muslim should learn the rulings on that act of worship so that he will be able to do it in the prescribed manner.
For more information, please see the answer to question no. 109337
Secondly: what we understand from your question is that you entered ihram for Hajj from the outset, then when you reached Makkah, you performed ‘Umrah with the people. If that is the case, then your Hajj is valid and that ‘Umrah superseded the Hajj you had intended. It does not matter that you did not form the intention of doing ‘Umrah at the miqaat, because the Sahaabah did not have the intention of doing ‘Umrah from the outset; rather they intended to do Hajj, yet despite that the Prophet (blessings and peace of Allah be upon him) instructed them to cancel their Hajj and make it ‘Umrah.
Abu Dawood (1788) narrated that Jaabir (may Allah be pleased with him) said: The Messenger of Allah (blessings and peace of Allah be upon him) and his companions came when four days of Dhu’l-Hijjah had passed, and when they had circumambulated the Ka‘bah and gone between as-Safa and al-Marwah, the Messenger of Allah (blessings and peace of Allah be upon him) said: “Make it ‘umrah, except for whoever has brought a hadiy (sacrificial animal) with him.” Then on the day of at-Tarwiyah (8th Dhu’l-Hijjah), theyentered ihram for Hajj, and on the Day of Sacrifice, they came and circumambulated the Ka‘bah, but they did not go between as-Safa and al-Marwah.
Classed as saheeh by Shaykh al-Albaani in Saheeh Sunan Abi Dawood.
Al-‘Azeemabaadi (may Allah have mercy on him) said:
“Make it ‘umrah”: this was addressed to those who were doing Hajj on its own (Hajj ifraad), because they were three groups, as was stated by al-‘Ayni. What was meant was: Change it to ‘Umrah, to highlight opposition to what had been the practice during the Jaahiliyyah, when they regarded it as forbidden to do ‘Umrah during the months of Hajj.
End quote from ‘Awn al-Ma‘bood Sharh Sunan Abi Dawood (5/148)
Shaykh Saalih ibn Fawzaan was asked: Is it permissible to change the intention from ifraad after doing tawaaf and saa‘i, and make it tamattu‘?
He (may Allah preserve him) replied: There is no reason not to do that; rather it is better to change it from ifraad to tamattu‘. So when he has done tawaaf and sa‘i, he should cut his hair and exit ihram and count it as ‘Umrah, then he should enter ihram for Hajj after that, and he will be doing tamattu‘. This is called changing Hajj to ‘Umrah. The Prophet (blessings and peace of Allah be upon him) ordered his Companions to do this after they had done tawaaf and sa‘i; he told them to cut their hair and make it ‘Umrah, and to enter ihram for Hajj after that so that they would be doing tamattu‘, except those who had brought the hadiy (sacrificial animal) with them; they were to remain in ihram.
End quote from al-Muntaqa min Fataawa al-Fawzaan (5/162).
Shaykh ‘Abd al-‘Azeez ibn Baaz (may Allah have mercy on him) was asked: If a person does Hajj with the people, and does what they do, without knowing the essential parts, obligatory actions and Sunnahs of Hajj, what is the ruling on his Hajj?
He (may Allah have mercy on him) replied:
His Hajj is valid, so long as he does what the Muslims do, of standing in ‘Arafah, going to Muzdalifah and staying there overnight, tawaaf and sa‘i, and all the other actions of Hajj, and stoning the Jamaraat. Praise be to Allah, his Hajj is valid.
The point is, so long as he did the actions of Hajj, even if he did not have knowledge – rather he imitated the people in what they were doing, and did what they did of the actions of Hajj – his Hajj is valid and is acceptable, but he is not like one who does Hajj with knowledge and understanding, because that is preferable.
What is required of the pilgrim is to learn and to ask the people of knowledge about anything that he does not understand, so that he will have knowledge and insight. Nowadays, praise be to Allah, there are booklets that explain the rituals of Hajj, and we have a booklet that covers most of the actions of Hajj, which we called at-Tahqeeq wa’l-Eedaah li Katheer min Masaa’il al-Hajj wa’l-‘Umrah wa’Ziyaarah [available in English under the title “Verifying and Explaining Many Matters of Hajj, Umrah and Ziyarah”], which is a useful booklet, and there are many other booklets. The point is that the seeker of knowledge and the Muslim who wants to perform Hajj can keep with him a booklet written by people of knowledge, which will help him learn about matters of Hajj. He can also ask people of knowledge before he goes to Makkah about things he may be unaware of, and he can ask the teachers in Makkah, in al-Masjid al-Haraam, about anything he is confused about.
End quote from Fataawa Noor ‘ala ad-Darb by Shaykh Ibn Baaz
For more information, please see the answer to question no. 109357
And Allah knows best.