Birds in the wild do not bite, so you must understand that this is something that they have learned as a pet in your home, or in someone else's home if he came to you as an adult.
Parrots are prey animals and when they feel they are in danger, their response is flight. In our homes, with clipped wings, flight is not possible, so they feel the need to defend themselves and/or their home or mate and their beak is the best method of defense.
If you have developed the habit of putting your bird back in his cage when he bites, he has now learned that if he wants to go to his cage for something to eat or a nap, all he has to do is bite someone.
If your bird is not feeling well and does not want to come out of the cage, he may bite a hand that comes into his home to take him out.
If it is springtime and your bird is hormonal, you may receive a painful bite if you try to take him out of his cage – or try to put him back in his cage – or if someone approaches you while he is on your shoulder.
A bird will normally feel your finger or hand before stepping up for you and if you have ever moved quickly away when this happened, you might have taught your bird to grab the hand & hold on so you can't move.
Birds love drama and if you ever yelled out in pain or said words you don't normally say after a bite, your bird just might bite again in order to see and hear the same reaction.
For information on what to do about a biting bird, please see A Biting Bird – What To Do If Your Bird Bites