It's true, you did do something bad. Despite being in a relationship with someone, something that requires trust and communication, you do not fully trust your partner, and that is hurting your relationship. However, that does not erase the fact that your boyfriend has a naked picture of another girl on his phone. You may have done something bad, but he has, too.
Neither action cancels out the other. You may have found the pictures on his phone, but that didn't make it okay to look through it. Likewise, he's done something to very rationally and logically cause you to not trust him in the first place. Either way, just because it's good that you feel sorry for doing something bad doesn't mean you aren't allowed to be angry or hurt over this picture. What you did doesn't erase what he's done.
Honestly, I don't think what you guys have right now is a healthy relationship. So, you have two options: end it now, since being in an unhealthy relationship is never a good idea, or two, talk with him and work things out.
Whatever you do, you do need to talk with him first. Admit to what you did and apologize, but don't forget that you deserve to feel hurt and angry about this picture. Then you have to consider: Do I ever think I will trust him? Am I willing to work on my trust issues? Does he have a good explanation for this picture, and/or did he sincerely apologize (as in, a real "I'm sorry" instead of an "I'm sorry you're sorry")? And most importantly, is this relationship even worth being in? Do you care about him enough to stay, and does he care enough about you, respect you and understands that this relationship isn't going to be easy, and that your trust issues aren't your fault?
They aren't your fault, by the way. Trust is something you give to someone you honestly believe isn't going to hurt you. People violated that, and that's not your fault. You were hurt, and it's okay that you're afraid of getting hurt. Most people are. There's nothing wrong with being afraid when you've been given a reason to. That's why asking if this is worth it is so important. Yes, eventually you will have to learn to trust again, if only for your own sake. The question is, is this man someone you think will be with you and support you every step of the way? If no, it might be time to end things.