How does a JavaApplet run and what are the security issues related to it?

Java Applets are not Java Servlets. Applets run on the
application side (normally in web-browsers); servlets
run on the server-side, normally as part of a middle tier
application server environment.
Regardless, servlets or applets, both are compiled Java code which executes in a platform-neutral virtual machine called the Java Virtual Machine.<P>

The purpose is to 'write once and use everywhere' by having
maching independent code. Hence, the Sun servicemark:
The Network Is the Computer
This concept takes time to understand. Recommend you
get a good book on high level Java architecture. You might
try:<P><P> and then search (deeper) for something more basic.