If there is a significant difference in the objectives set by your immediate supervisor and those set by their manager, you have got quite a problem. I assume you let the other know if/when one sets a different objective than the other? I also wonder why your boss's boss is setting your objectives at all, so that is a different question.
But, to address your question, let's assume this is normal and you often receive direction from both of them, and sometimes the goals are different. I would say try to do both when you can. If you have to choose, try to let each one know what your trade-offs are and either 1) ask them to decide together which you should do, or 2) ask them to support your choice.
When there is a conflict (there are always unlimited potential objectives and limited resources) it would be best if you could all decide as a team, based on what is best for the customer and the business. Simple loyalty has nothing to do with it.
you may miss reporting directly to your old boss and think your new boss (who was promoted over you?) is a "jerk." Try to come to some peace about this for yourself: your new boss is now your supervisor, like it or not and as such will evaluate you, determine your comp, might need to fight for you someday, and could fire you.
Time to decide: either you accept your new boss as legit, or leave.