Butter contains saturated fats. Therefore, it cannot be hydrogenated. On the other hand, oil has unsaturated fats. That is why it can be hydrogenated to saturated fats (solids).
Your comment on this answer:
Related questions
Doubtly is an online community for engineering students, offering: