While Java applets run on the client computer (ie your machine). Common Gateway Interface scripts are run on the server (ie, the machine at the other end of the wire from yours).
This can have its disadvantages. If a large number of users are all trying to access data from the same server, it can slow things down.
However, it does mean that execution of some functions (like sending a mail message) can be performed independently of the browser used.
So, what can you use them for in education? At the simplest, you could use one to maintain a guestbook or a discussion group on a website.
However, there would be nothing to stop you from creating a script that would take data entered on a form, process is and then, depending on the result, display a different webpage. With tools like that, even elementary students can write interesting simulations.