Which affiliation to put as a student in a different branch than the research paper?
For an undergraduate student, the affiliation is usually the same as the affiliation of your supervisor.  If you are unsure, ask them.
If you are writing the paper independently, typically the affiliation is in the format:

Department, University Name, Address

At some universities, undergraduates do not have a department, in which case that might be omitted.
It is perfectly fine if your affiliation is unrelated to your paper topic.