وَهُوَ مَنْ لَقِيَ النَّبِيَّ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ مُؤْمِنًا بِهِ وَمَاتَ عَلَى الْإِسْلَامِ
A Companion is someone who met the Prophet ﷺ while believing in him and died upon Islam.
The definition attributed to al-Ḥāfiẓ Ibn Ḥajar al-ʿAsqalānī gives two essential requirements: meeting the Prophet ﷺ while in faith and dying as a Muslim.
Simply living in the Prophet's lifetime is insufficient; both meeting while believing and dying upon Islam matter.