Fun implies some utility. I like being around the friend because we’re doing fun stuff, like partying or joking around.
Joy means that whatever we do, I am simply happier because I am with the person. We could be doing non-fun stuff, like filing boring paperwork or the friend could be visiting me in the hospital cause I broke my leg, and I am in a lot of pain, but the mere presence of the person brings me joy.