Being that he is still in high school, he may still be at a stage where he isn’t entirely certain of his sexuality.
In other words, he may have both gay and heterosexual tendencies.
He may have kept his relationship with you a secret because he is still wrestling with his sexual identity.
This may also be partly the reason why he ultimately cheated on you with another girl.
Oftentimes, a gay guy who is still wrestling with his sexual identity will feel the need to continuously go out with girls until he gets to the point where he either accepts the fact that he is truly gay or that he is actually bisexual.