There are multiple reasons for this and the last one is worse:
Android is owned by Google, not the phone manufacturers
These manufacturers take time to customize the OS to their taste
Some just want people to buy new phones, so in their minds, they think that if they don't update the current phones, their users will just throw them away and get a new one. (this is mostly common in cheap android phones)
iPhones get regular updates because Apple owns iOS and it doesn't need to pass through another manufacturer to get to the end user, thats why the only android phones that get as much updates as iPhones and the Pixel phones (5yrs of updates) because they are manufactured by Google, the owners of Android OS