BEIJING—International Business Machines Corp. has agreed to let China review some product source code in a secure room, according to two people briefed on the practice, making it the first major U.S. tech company to comply with Beijing’s recent demands for a stronger hand in foreign technology there.

IBM has begun allowing officials from China’s Ministry of Industry and Information Technology to examine proprietary source code—the secret sauce behind its software—in a controlled space without the ability to remove it from...