I thought Sylar accidentally learned of his powers in the first season when he was trying to work on them with Suresh's father.
Ive always considered his ability and Peters ability to be the "black and white" or "good and evil" comparison.
Peter is basically an empathetic character who can absorb the powers of those he is near.
Sylar on the other hand (Gabrielle which is interesting because now you have Peter as in St. Peter, Nathan a prophet who god spoke to during the time of David and Solomon, and Gabrielle who is also supposed to be a messenger of god.), gets his powers through killing.