In pyridine, the aromatic compound already has 6 pi electrons (also, it satisfies all the other criteria for aromaticity), so the lone pairs on nitrogen doesn't contribute to the compound, whereas in pyrrole, the lone pairs on nitrogen do contribute to give an aromatic sextet, b/c there are only 4 pi electrons .
hope this helps!