Could be lots of reasons - age, ammonia, fin rot, some infection. With betta purchased from shops it is hard to tell their age - those pictures of yours suggest he was a minimum of 7 months old as had full finnage. To be honest, betta in captivity do not last for years and years like other fish, occasionally you will get one that lives past 2, but I would expect their life span to be a max of 13 months.
When you clean out the filter rinse it with tank water, not tap water. My filters hold multiple layers of sponges and filter material and I only ever clean out 1/3 at any time, using water I am taking out of the tank. It rinses out the gunge but leaves enough bacteria in there to stop an ammonia spike.