Without wanting to be silly about it, the reason trains to Inverness take so long is because it's a flipping long way through challenging terrain! Linespeeds along the route are typically about 75mph but there are plenty of sections where they are higher (and slower sections are usually on the approach to stations where trains will be slowing down anyway).
Re the comment about trains being faster in the past ... it depends when you are looking. Comparing a 1995 timetable with the current service, journey times were pretty much the same as now.
Edinburgh to Inverness – 1995: 3h32, 3h43, 3h35, 3h30, 3h32 – 2023: 3h23, 3h42, 3h47, 3h34, 3h51, 3h38
Glasgow to Inverness – 1995: 3h22, 3h20, 3h32 – 2023: 3h22, 3h18, 3h22, 3h19, 3h34
The fastest journeys are now faster than they were back then. The reason that the 3h51 journey from Edinburgh is so much slower is because it has two waits totalling nearly 15 minutes between Aviemore and Inverness where it gets looped to allow trains to pass – but with one extra journey from Edinburgh and two extra journeys from Glasgow compared to 1995, that seems a small price to pay.
Having just returned home after a trip up to Carrbridge, it didn't feel like a slow route – most of the time, we were speeding past traffic on the parallel A9. It was noticeably slower on the climb up to the summit than down the other side(!) so I don't know whether taking on the 185 Desiros that TransPennine don't need would allow them to speed up the service – although 1️⃣ because most of the line is single track, you might find that running faster on one section just means you have to wait longer at the next passing loop, and 2️⃣ I doubt that 3-car Desiros would give sufficient capacity without running additional services.
Given the relatively small number of people travelling on the route, it doesn't seem like a priority for the kind of heavy engineering that would be needed to make any significant difference to journey times (unless that can be achieved simply by putting on more powerful trains and improving the pathing), when you could get a lot more bang for your buck elsewhere. Of course, if the suggested tunnel under the Forth went ahead then that could see the Edinburgh trains routed via Kirkcaldy again with a decent time saving, but I don't think that is likely to happen any time soon.