It is because they use different calendar settings. ParseDateTime, now you have tested it, uses ISO. For ISO, if Jan 1 falls on a Mon/Tue/Wed/Thu, then it is week #1. If Jan 1 falls on a Fri/Sat/Sun, it is week 53 from last year. Therefore, for 2021, you get 38 from ParseDateTime.
For Java, week number is calculated based on your local settings. If the minimum days in first week is set to 1, as in your case, you get 39. If the minimum days in first week is set to 4, similar to ISO and in other parts of the world, you get 38. Java is more versatile because you can set the minimum days in first week to suit your needs.
If you really don't want to use Java at all and use ParseDateTime, you can always check the week of Jan 01 to see if it returns 53 or 1. If it returns 53, you can then add 1 to %dt_week_of_year.