If you assume the axiom of foundation, then yes, this is possible. If you do not assume the axiom of foundation, it may be impossible.
The relevant axiom scheme is the axiom scheme of (strong) collection. This scheme can be phrased as follows:
Suppose $\forall x \in X \exists y (\phi(x, y))$. Then there is some indexed family of inhabited sets $\{Y_x\}_{x \in X}$ such that $\forall x \in X \forall y \in Y_x (\phi(x, y))$.
Over the axiom of choice, the collection scheme is equivalent to your proposed choice scheme.
For suppose the collection scheme, and pick some $\{Y_x\}_{x \in X}$ as described. Then the axiom of choice tells us $\prod\limits_{x \in X} Y_x$ has an element $f$, and we see that $\forall x \in X (\phi(x, f(x)))$.
Conversely, suppose there is some function $f$ with domain $X$ such that $\forall x \in X (\phi(x, f(x)))$. Then we can define $Y_x = \{f(x)\}$. As you’d expect, no choice is needed for this direction.
Let’s take a look at the axiom scheme of collection. It is well-known that this scheme follows from $ZF$ set theory using the so-called “Scott’s Trick”. This requires some knowledge of the “cumulative hierarchy” and the axiom of foundation, but if you’ve made a usual introductory study of $ZF$ set theory, it will be within your grasp.
However, it is also known that in $ZFC^{-}$ - that is, $ZFC$ without the axiom of foundation - the axiom scheme of collection can fail. For more details on this, see this question and answer. Be warned that this answer is highly technical and references another technical answer - you should be familiar with permutation models of ZF with atoms and how these can be translated into models with Quine atoms before proceeding.
Notwithstanding all of this, there is a broad class of instances of the axiom scheme of collection, known as “structural collection”, which always holds even in $ZFC^{-}$ due to the presence of the axiom of choice.
For some elaboration on this and a summary of this topic (and some alternatives to foundation), I would recommend my own answer to this question. My answer does use the language of classes, so be warned.
From your comments, you seem like you may be unfamiliar with how to translate statements about classes into statements about sets; I find the perspective in Kunen’s book Set Theory: An Introduction to Independence Proofs to be a useful one if you dislike the “ontology” of classes. He explains how to translate a statement involving classes into a metatheorem about set theory.