I remember a movie where a boy has a crush on hos teacher. His friend does experiments trying to make edible plants grow faster, but they keep exploding, and he gets in, and becomes an adult. He starts dating his teacher, while his friend tries to fix his machine and reverse the function to turn him back.
At the end, the teacher also gets in, and joins him in the class, and the nerdy friend ages himself and becomes the teacher, played by Rick Moranis.
This is not listed on Rick Moranis’ IMDB nor wikipedia.
I believe the title to be something like “13 going on 30”, or “17 …”.
It is not “Big” with Tom Hanks, not the 2004 one with Jennifer Garner.
“14 Going on 30” (1988 TV movie)?
https://www.imdb.com/title/tt0094592/?ref_=kw_li_tt