We present a mechanism by which optically driven chiral phonon modes in rare-earth trihalides generate giant effective magnetic fields acting on the paramagnetic $4f$ spins. With cerium trichloride (CeCl$_3$) as our example system, we calculate the coherent phonon dynamics in response to the excitation by an ultrashort terahertz pulse using a combination of phenomenological modeling and first-principles calculations. We find that effective magnetic fields of over 100 tesla can possibly be generated that polarize the spins for experimentally accessible pulse energies. The direction of induced magnetization can be reversed by changing the handedness of circular polarization of the laser pulse. The underlying process is a phonon analog of the inverse Faraday effect in optics that has been described recently, and which enables novel ways of achieving control over and switching of magnetic order at terahertz frequencies.