What exactly is an algorithm?
The informal definition of an algorithm in a popular textbook goes something like:

An algorithm is (1) a well defined computational procedure (2) that takes some input and (3) produces some output (4) for a well defined computational problem.

In your first case you have coded an algorithm where:
The problem is to find the factorial (part 4 of definition),
given int n as input (part 2 of definition),
the code describes the computation to be performed (part 1 of definition),
the output is the factorial (part 3 of definition).

In your second case:
The problem is to find the array element at position n (part 4 of definition),
given n as input (part 3 of definition),
the code describes the computation to be performed (part 2 of definition),
the output is the element at position n (part 1 of definition).

You have stored factorials there so it gives you factorials. If you had stored squares or cubes there you'd get squares or cubes, so it cannot be said that the second snippet by itself is an algorithm to compute factorials.

And if you say that an array look up along with an array having f(n) at position n is an algorithm to compute f(n) then you have gone so deep that there is no more computation below. A well defined computational procedure should be a finite piece of information. If an infinite array of factorials is a part of the computational procedure this does not hold. So that wouldn't be an algorithm to compute factorials.