I am not really sure what you mean by 3 years. The Prophet ﷺ stayed in Makkah for around 13 years. Then he migrated to Medinah and military activities started soon after migration, the expedition of Hamza was dispatched in the first year - similarly there were several other military activities before the Battle of Badr. The rest of this answer assumes that you meant to ask as to why the Prophet ﷺ did not fight before the migration to Medinah.
The Prophet ﷺ did not fight the disbelievers during the early Makkan period of Islam because Allah had commanded him to be patient and to pardon, overlook and turn away from the disbelievers in verses such as 73:10, 41:34, 5:13, 16:125, 24:54, 25:63, 88:22, 3:186,
50:45, 45:14, 15:94, 15:85. Later He abrogated it and permitted and then obligated fighting.
This is evident from the Quran:
ألم تر إلى الذين قيل لهم كفوا أيديكم وأقيموا الصلاة وآتوا الزكاة فلما كتب عليهم القتال إذا فريق منهم يخشون الناس كخشية الله أو أشد خشية
Have you not seen those who were told, "Restrain your hands [from fighting] and establish prayer and give zakah"? But then when fighting was ordained for them, at once a party of them feared men as they fear Allah or with [even] greater fear.
— Quran 4:77
And hadith:
فقال " إني أمرت بالعفو فلا تقاتلوا " . فلما حولنا الله إلى المدينة أمرنا بالقتال
He said: “I have been commanded to pardon, so do not fight.” Then, when Allah caused us to move to Al-Madinah, He commanded us to fight.
— Sunan Nasai
And consensus:
ولا خلاف في أن القتال كان محظورا قبل الهجرة
There is no disagreement on the fact that fighting was forbidden before the migration
— Tafsir al-Qurtubi also see Tafsir al-Jassas
شرع الجهاد بعد الهجرة النبوية إلى المدينة اتفاقا
Jihad was prescribed after the Prophet's migration to Medinah, by agreement
— Fath al-Bari
As for the wisdom behind it, then it could be that the Muslims did not have enough strength to effectively fight at that time. And it could also be a period of respite from Allah to allow the disbelievers time to be repent and reform.