In movies (and mostly cartoons), it’s often used as a solution to any ‘death’, so it’s more just misleading
For the heart to pump blood, the muscles need to contract in a specific pattern. This is coordinated by a part of the heart using a form of electricity.
When these contractions get out of sync and blood stops being pumped (ex. certain types of heart attacks), we can use a defibrillator/AED to get everything in sync again.
If that is not the cause of the cause of the problem, the defibrillator wont’ work.
In movies (and mostly cartoons), it’s often used as a solution to any ‘death’, so it’s more just misleading