Does failing in a different program affect graduate admission application? Suppose, someone failed in a STEM grad program 'A', and hence it is incomplete. 

Then he gets acceptance in a non-STEM grad program 'B', and completes it.

Now, if he applies for a position in a funded Ph.D. program related to 'B', would he face hard-times in getting an acceptance because of his previous failure?

Why or why not?

Kindly, explain.
It might.

First off: there is no record of you failing the program so it’s unlikely that anyone will know unless they actively try to find out. So, I wouldn’t highlight it. If they do find out, I strongly recommend telling the truth, it’s easy to find out whether you we’re enrolled. From now I’m assuming that the committee somehow finds out, or you tell them.

You have tried to get through one grad program and did not succeed. Taken on its own, this sends a negative message to the admissions committee, especially if your prospective topic is relevant to your past CS experience. 

But grad applicants are humans, and humans make mistakes. You need to tell the grad committee what you learned from that experience and why do you think it won’t happen again. Don’t make it the focus of your application (again, they probably won’t know). You need to tell them what your strengths are and how you’d fit the grad program. As with every case, it’s hard to say how they’d react, because we don’t know what your portfolio is like.