If you raised him as a pet, then he most likely thinks of you as a subordinate member of the flock. You aren't doing what he wants you to, so he's disciplining you.
You probably "told" him that you were his subordinate by grooming him (petting) as hens groom the rooster. You may also have held him up near your face and/or let him roost higher than your eyes. You may also have moved away from him once he became aggressive, further showing him that he was the boss.
You can try to discipline him, but it nay be far too late and you may have to cull him and try again. With your next rooster, don't pet him, don't hold him, don't cuddle him. Treat him with respect as the potentially dangerous animal he is. Make sure he moves away from you when you walk towards him, and that he respects you as the Alpha.
You can try running after him, squawking and flapping your arms, and chasing him around if he makes an aggressive move. Catch him and pin him to the ground until he stops struggling before you let him up. See if that will do him some good, and teach him that YOU are the alpha rooster. Unfortunately, it might also make him sneaky.
Personally, I would cull him. There are thousands of non-aggressive roosters killed every day simply for being male. Give one of them a good home.