We developed a new optical sensor for tracing Hg(II) ions. The detection affinity examines within a concentration range of 0–4.0 µM Hg(II). The sensor film is based on Methyl 2-hydroxy-3-(((2S,2’R,3a’S,5R)-2-isopropyl-5,5’-dimethyl-4’-oxotetrahydro-2’H-spiro[cy-clohexane-1,6’-im-idazo[1,5-b]isoxazol]-2’-yl)methyl)-5-methylbenzoate (IXZD). The novel synthesized compound could be utilized as an optical turn-on chemosensor for pH. The emission intensity is highly enhanced for the deprotonated form concerning the protonated form. IXZD probe has a characteristic fluorescence peak at 481 nm under excitation of 351 nm with large Stocks shift of approximately 130 nm. In addition, the binding process of IXZD:Hg(II) presents a 1:1 molar ratio which is proved by the large quench of the 481 nm emission peak of IXZD and the growth of a new emission peak at 399 nm (blue shift). The binding configurations with one Hg(II) cation and its electronic characteristics were investigated by applying the Density Functional Theory (DFT) and the time-dependent DFT (TDDFT) calculations. Density functional theory (DFT) and the time-dependent DFT (TDDFT) theoretical results were provided to examine Hg(II)-IXZD structures and their electronic properties in solution. The developed chemical sensor was offered based on the intramolecular charge transfer (ICT) mechanism. The sensor film has a significantly low limit of detection (LOD) for Hg(II) of 0.025 μM in pH 7.4, with a relative standard deviation RSDr (1%, n = 3). Lastly, the IXZD shows effective binding affinity to mercury ions, and the binding constant Kb was estimated to be 5.80 × 105 M−1. Hence, this developed optical sensor film has a significant efficiency for tracing mercury ions based on IXZD molecule-doped sensor film.