If a classmate from the same class invites you to his birthday party, it means he thinks highly of you. It is rare for him to invite you to a birthday party, so even if you have an ordinary relationship with him, you still have to give him face, so you must go.
For such classmates with whom you have an ordinary relationship, you must be careful when giving birthday gifts. Don't give them casually, otherwise you will make some jokes. If the relationship is not close, there is no need to give very expensive gifts, and don't give gifts that will cause criticism.
It is more appropriate to give him some crystal ornaments with some simple blessings on them. Blessing chocolates, plush toys, real dolls, sun jars, etc. are recommended.
Of course, you can also give him some items he likes. It is also a good way to cater to his preferences. I hope it helps you.