Why was this sailor painting a Swastika on the ship? Was it a count of U-Boat kills? Is it realistically depicted in the movie?
Those are victory or kill marks. It was very common for tanks, planes and ships to mark their kills on both the Allied and Axis sides during the war.
The "Rising Sun" flags indicate the sinking of a military naval combatant vessel, the red dot flags are supply ships, and the pennants indicate merchant vessels. The half flags indicate an assist - some other ship claimed the kill.
At some point since the War, it's become more common to use generic symbols rather than national flags, but the practice still continues.