Table of Contents help in user readability, that improves your page user engagement. A better UI.UX and engagement are crucial factors for ranking. Therefore, Table of Contents are good for SEO.