My guess would be either that your power supply died, or that your hard drive did. I would not advise you to repair that Mac yourself. Just opening it and properly reassembling it is difficult, and the power supply could shock you. By the time you paid a repair shop to work on it, you'd probably be looking at $200+ for a "simple" repair (involving replacement of the power supply or hard drive) – or MUCH more than that if t turned out that the motherboard was bad.
Your 2017 Mac can't update past Ventura – which will fall out of the "most recent three" in just a few months when Apple releases macOS 26 (Tahoe). I'm guessing that it also has either a slow mechanical hard drive or a slow 1 TB Fusion Drive. (For a lot of late-era 21.5" iMacs, the startup drive was their biggest Achilles heel.)
That might argue for replacing the machine, e.g. with
- A 24" M4 iMac
- A system based on a M4 Mac mini
- A system based on a M4 Pro Mac mini
You'd upgrade the CPU, macOS, and your startup drive all at the same time.