How is this lamda function beeing executed in an example for the Y combinator
I am just going to write h for almost-factorial because long names can sometimes obscure math.

We consider:

((lambda (x) (x x))
 (lambda (self) 
   (h (self self))))


Write foo for ((lambda (x) (x x)) and write bar for (lambda (self) (h (self self)))). Then our expression is just

(foo bar)


Using the definition of foo we see that this is equal to

(bar bar)


Then we use the definition of bar on the first occurrence of bar to see that this is equal to

((lambda (self) (h (self self)))) bar)


which in turn is just

(h (bar bar))


We discovered that (bar bar) is equal to (h (bar bar)). Let us write g for (bar bar), so g is equal to (h g). Taking into account the definition of h (which is jsut almost-factorial from your question) we see that (h g), and therefore g, is equal to

(lambda (n)
  (if (= n 0)
      1
      (* n (g (- n 1)))))


In other words, g is the usual factorial function. I hope I got all the silly lisp parentheses where they are supposed to be.