Will a engine from a 2002 2.2 engine cavalier fit into a 1999 cavalier 2.2 engine?

Yes, it should. Both these years were made with the Vtec engines. (They are identical). It was the 2003 and up that were made with the EcoTech I believe.