In the above reaction product B is:
Product B is

From the JEE Main 2022 · 27 Jul · Shift 1 paper. Try it, check your answer, then read the worked solution below.
In the above reaction product B is:
Product B is

Try it yourself first, then check your working against this.
Worked solution
Step 1. HCl replaces only the benzylic OH (the phenolic OH does not react), giving A, 4-(chloromethyl)phenol.
Step 2. NaI (Finkelstein) swaps Cl for I: B is 4-(iodomethyl)phenol.
(A)
Concepts used: Finkelstein reaction
Every past question tagged to the same part of the syllabus, with solutions.
All JEE Main questions on Haloalkanes and Haloarenes · All JEE Main questions on Alcohols, Phenols and Ethers
Past questions on the same topic (SN1 and SN2), each with a worked solution.
Timed, in the real format, and marked the moment you submit.