Question: My PhD supervisor (in the field of artificial intelligence) invited me to several meetings with another PhD student. Since I have more knowledge than my supervisor in some topics, I made many suggestions about how this student could improve his methodology. In total, I went to 5 meetings of 3–4 hours each. I could have used this time to do my own research.

When the other student started to write his manuscript, I asked to be an author, since I had contributed directly to the research, but he felt I only deserved to appear in the acknowledgments. So I asked my supervisor to be on the paper and even volunteered to help writing it. My supervisor said “Don't worry about his paper, you have your own things to do, and he is not going to submit this work anytime soon”.

One week later, they submitted the paper to a major conference without my name on it. I felt really insulted that they used my time and skills with no credit to me.

I didn't actively do the research or help write the paper, but I felt I was supervising the student since I have the most experience on this topic. Many academics in my field get their names on papers by just giving suggestions.

What should I do? I am planning on taking it to the head of department.

Answer: 
Actually, I think you should relax and take your advisor's advice. Collaboration is a good thing, and it is a two-way street. You give a bit and you get a bit. I assume you got an acknowledgement in the paper for your help. I don't think it would be appropriate if you weren't. But authorship is a different thing. 

You contributed ideas. Research seminars are often organized to give ideas to researchers but the members don't become co-authors in the normal case. 

Congratulate your colleague and, as your advisor suggests, spend your effort on your own work, not raising an objection to someone else's. 

But, it is good that you contributed ideas. Do that a lot and you will have a lot of people willing and happy to work with you. Occasionally you may need that help. 

Pay it forward.
In the future I’d suggest being clearer about whether a project is joint work earlier in the process. It doesn’t sound to me from your description that you deserve coauthorship, but I do see why you feel shortchanged. The earlier on that you have this conversation the less chance there is for miscommunication and hurt feelings.