Cat attacks out of nowhere

I adopted my cat in april last year. Hes an orange almost 2 year old. He got adjusted very quickly after about half an hour he was on the couch laying in my lap and purring. After about two weeks he started chasing me around the house and attacking my legs while i was just walking around not even paying attention to him and i found it funny until it escalted to him biting and attacking me all the time out of nowhere. I feed him 3 times a day the proper amount so hes the perfect healthy weight, i play with him often, he has acess to a lot of stimuating activites and has places to climb and observe from. Hes a pretty active dude so i wanted him to have the proper tools to get his energy out. Hes not super cuddly and i never force it on him i give him a few pets if i see him laying somewhere am passing and the rest i wait for him to initiate. So he come up on the couch or bed on his own term asking for pets and cuddles, purring the whole thing. I even stop every now and then to check if he will want more pets and if he does he will lean his head on my hand or phone and if not i stop so i feel like am respecting him as much as possible. Even with all of that he will attck me while in my lap where he came up on his own and while purring. He bites my hand and then starts chewing it. Its extremly painful but if i try to move away he will just start chewing faster so i have to wait for him to be done even tho its super painful. At this point ive started not enjoying the experience of having a cat because of the attacking and even considered returning him to the shelter even tho thought of that makes me so sad. I would greatly appriciate any and all advice and would like to hear what others have done if anyone had the same problem. Should i get another cat to keep him company? I foster dogs and he LOVES playing with them and always wants to be super involved. Anyway, thank you sm!

Edit: Thank you for all the tips everyone! Hopefully the comments will make my boyfriend think about getting a second kitty