Infinity is a number, in some number systems (the extended reals, for example).
It is not an element of any of the sets of whole numbers, natural numbers, integers, rationals, reals, or complex numbers, though. Really, talking about infinity at all in reference to these systems is meaningless. When we do so, we are appealing to the fact that we can extend our systems to include infinity as an element. We do not use these extended systems in most situations, though, because if we do then many of our operations need to be redefined (infinity does not work naturally with ANY "arithmetic" operation). It is simply a matter of convenience.
The fact that you have been taught that infinity is strictly not a number is irrelevant. Indeed, from your perspective it is probably an ill-defined concept. This does not make it so from the perspective of mathematics.
An identity element, e, of a nonempty set S with respect to a binary operation \langle \ , \ \rangle: S \times S \longrightarrow S is one such that
\langle x \ , \ e \rangle = \langle e \ , \ x \rangle = x
for every x in S.
With respect to the integers and multiplication, 1 is an identity element. In the exact same way, with respect to the integers and addition, 0 is an identity element.
The natural numbers, integers, rationals, reals, and complex numbers are mathematical contructs. Trying to put them in direct correspondence with things in the world in which you exist is wrong. Sometimes we are lucky, and can discover some such constructs that model the world in a sufficiently good manner. Such constructs are usually described as "natural" or "intuitive," but these are purely subjective terms.
Let's say we have a set E with a binary operation \cdot. In addition, assume that it does not have an identity element with respect to \cdot, so there is no element x such that
x\cdot y = y \cdot x = y
for every y in E.
We can then define an object e by
e \cdot y = y \cdot e = y,\; \mbox{and} \; e \cdot e = e
for every y in E. Then the set E \cup \{ e \} does have an identity element with respect to \cdot. If E is the whole numbers, and \cdot is +, then we can perform precisely these steps to get an additive identity. We just call this identity element "zero" or 0.
Simple mathematical construction.
In contrast, we could define an "infinity element," i, of a set S with respect to a binary operation \langle \ , \ \rangle: S \times S \longrightarrow S by
\langle i \ , \ x \rangle = \langle x \ , \ i \rangle = i
for every x in S.
Under this definition, we can look at the natural numbers and addition. Is there any element satisfying this definition? No. Can we define one? Certainly. Define \infty by
\infty + x = x + \infty = \infty, \; \mbox{and} \; \infty + \infty = \infty
for every natural x. So now, the set \mathbb{N} \cup \{ \infty \} does have an infinity element under our definition, and \infty is a number, ie. an element of the set.