Trimetazidine is primarily used to treat angina pectoris, a condition characterized by chest pain due to insufficient oxygen supply to the heart. It can also be used for other heart-related conditions like heart failure and peripheral artery disease.