because asm is written by humans, which means that it can be tweaked and optimised specifically for the given task.
other languages are translated into asm by the computer before they are able to be run, which means that their optimisations and such are alot more generalised.
if someone who sucks at asm writes a program it may be slower than the compiler generated code. it depends on the author's skill level