Hello Lior Elayev,
In Case 1, the AS path 64512-64520 indicates that to reach the prefix 172.31.0.0/16, the route has to traverse through two Autonomous Systems (AS) - 64512 and 64520. This could be due to the configuration of your network where the traffic to this prefix is routed through multiple AS.
In Case 2, the AS paths are 64512 and 64520 separately for the same prefix 172.31.0.0/16. This means there are two separate routes to reach the same prefix, each traversing through a different AS. This could be due to multiple connections (like VPN or ExpressRoute) from the virtual hub to the on-premises network, each advertising a route to the same prefix through a different AS1.
https://learn.microsoft.com/en-us/azure/virtual-wan/effective-routes-virtual-hub
If the information helped address your question, please Accept the answer.
Luis