I'm not sure how to fix this but i've seen a few different solutions and i'm not sure which one would be best. I thought it was just a random thing but a few days later I was playing sims 4, which usually causes the MacBook to overheat and the fans to go off a little bit but never anything bad, and after about 15-30 minutes, maybe less, the fans and overheating goes crazy and I have to quit and wait for things to cool down before starting up the game again, which is obviously something I want to fix because I play that game for way longer than 15 minutes at a time. The only thing that seemed to fix it was restarting my computer.
The other day I was using idle (i think that's the name for it? it's used to code python), and I had a few tabs open on safari and maybe spotify open too, nothing too demanding and the fan started getting really loud really fast and it was overheating more than i've ever felt. I just use it to do homework and browse the internet or whatever, nothing crazy. I've had my 2017 13 inch MacBook air for over a year and a half now and it's had pretty much no problems. I don't know if this is the right place to ask this but i've been trying to look up solutions to this problem and i haven't found anyone with the exact issue as me, only things kind of similar.