Currently there's a lot of traffic in the center of my city. I tried avoiding that by creating a circle road on the outskirts of the city, but it's almost always completely empty. I used that road to divert truck traffic coming from my industrial zones towards the main highway. However, trucks still prefer to pass through the most congested areas and make it even worse.
Does traffic in the game know what's the best route to take or does it just choose the shortest point-to-point road without taking congestion into account? How would I force trucks to avoid their basic behavior if they just just the shortest route?
Traffic generally just takes the shortest route which can easily cause congestion.
There are several ways to combat it in my experience:
Use public transport (obviously that won't help your truck traffic though)
Designing of the roads so that trucks for example will have to go to a larger road, almost like having separate areas of you city only connected by highways
Use policies to restrict traffic, there is one for no HGVs
Using the Traffic Manager: President Edition mod so you can restrict traffic types on specific roads. This will give you so much power over almost all parts of your transport system, I wouldn't play without it! Traffic restrictions, junction restrictions and lane joining make funneling your traffic around so much easier
Traffic does not know the best route, but it should find it. On a highly congested road you should see cars disappearing, and later cars should also try a different route. However, they do not try to find the route that is best for the overall good, just best for them. So if it is still faster for the trucks if some of them take the short route, then they will, even if this makes it worse overall. Just as in real life.
I want to try out the mod XN16 suggested, I think that will work out best. However, for a mod-free solution, I've gotten into the habit of creating dedicated roads between the highways and my industrial centers. Make the road sufficiently wide so it can carry a lot of traffic, and don't give it any connections to the normal city roads. If you make it direct enough, the trucks will naturally start to favor it since it will be the shortest route. Remember that you can create roads as overpasses and tunnels if you need it to run straight through an area that has already been developed and you don't want to destroy (much) of what is there. For starting a brand new city, I usually make a road to/from my initial industrial areas as close as possible to the starting entrance/exit to the city so that the trucks never even have to go through the city center in the first place, and if you can purchase the land containing the highway, building custom connections for dedicated truck traffic works best.