It is called "generalized inverse". In that case $fg$ and $gf$ are idempotents. In particular, if you have a semigroup of maps $X\to X$ (i.e. a set of maps closed under composition) such that every $f$ has a generalized inverse, the semigroup is called {\em regular} regular. If the generalized inverse is unique, the semigroup is called {\em inverse} inverse. See Clifford and Preston "Algebraic theory of semigroups".
It is called "generalized inverse". In that case $fg$ and $gf$ are idempotents. In particular, if you have a semigroup of maps $X\to X$ (i.e. a set of maps closed under composition) such that every $f$ has a generalized inverse, the semigroup is called {\em regular}. If the generalized inverse is unique, the semigroup is called {\em inverse}. See Clifford and Preston "Algebraic theory of semigroups".