Arlene, z/OSMF currently has no "merge" capability which allows you to install Java 21 into the target and dlib zones for your existing z/OS 3.1. But as you have already discovered you can install new target and dlib zones for Java 21 and connect them to your z/OS 3.1 global zone. Yes you must provide unique names for these Java 21 target and dlib zones. In addition, during the install you will NOT be merging or replacing the Java 17 data sets, so you must specify unique data set names for the Java 21 data sets, perhaps like SYS1.JAVA21.SIEALNKE. The result will be two separate installed releases of Java,17 and 21.
I hope this helps. Post up if you have additional questions. Here's a couple blog post that discuss some of the issues and questions surrounding this new territory of managing multiple releases of Java;
https://www.marnasmusings.com/2023/08/having-your-java-and-drinking-it-too.html
https://www.marnasmusings.com/2025/03/keeping-up-with-javas.html
Kurt Quackenbush -- IBM, z/OSMF Software Management and z/OS SMP/E