Before starting my Ph.D at university X, I had a research stay in university Y. I submitted a paper related to my work done at university Y and it took 2 years to be published. At the time of publication I was a Ph.D student at university X, but I did not tell my supervisor about the submitted paper, because it was related to my previous work which was not related to my Ph.D. I am afraid about my supervisor's feelings. Will this publication make him upset?
Any work you did at a prior institution—particularly something you did before starting a PhD in a different field—before joining your present institution is not really any of your current advisor's concern, unless working on it involved a significant distraction from your assigned work. (That is, he was paying you to work on project A, and you spent all your time working for project B.) It doesn't sound like this is the case, so I wouldn't lose any sleep over this.