Technically, Gastly had Hypnosis at level 1 and by the time you catch it the move has been overwritten by moves Gastly learns at higher levels. So, you need to obtain a Heart Scale in the underground and take it to someone in Pastoria City, who will then be able to teach Haunter Hypnosis.