The second one is correct.
For verbs that can have an indirect object, there are two ways to form sentences, each with the same meaning:
I [subject] gave the ball [direct object] to John [indirect object]
I [subject] gave John [indirect object] the ball [direct object]
To form the passive voice:
- drop the subject
- promote the object nearest the verb to subject
- change the verb to passive voice ([BE + past participle])
- if the direct object was promoted, we can add in "by [original subject]"
The corresponding passive voice sentences are:
The ball was given to John
John was given the ball
We can also reverse this process:
- restore the original subject
- demote the subject to object
- change the verb to active voice
- remove "by [original subject]" if it is there
Thus
I have been explained this problem
This problem has been explained to me
becomes
Someone has explained me this problem [1]
Someone explained this problem to me [2]
The problem is, the first sentence [1] is technically correct but unnatural. Sometimes, you can put the indirect object next to the verb and drop "to"
I gave the ball to John
becomes
I gave John the ball
I'm not sure why*, but that construction is not nearly as common for the verb "to explain". For this reason, the corresponding passive voice sentence is awkward. Therefore the more natural sounding sentence is
This problem has been explained to me several times but I keep forgetting about it.
* This is pure speculation, I am not a linguist, but one pattern I've noticed is that the method of putting the indirect object next to the verb only works with Germanic words or at least words that came into modern English via Old English. Perhaps this grammar pattern is from Old English, which is heavily Germanic. The following is correct and sometimes even preferred over the "to me" form. All of the verbs have roots in Old English.
- tell me something
- give me something
- buy me something
- show me something
- offer me something
- find me something
The following list has somewhat to extremely unnatural sounding phrases. They are all synonyms/similar verbs to the above, but came into modern English via Latin, via Latin through French, was recently made up, etc.
- explain me something
- transmit me something
- purchase me something
- demonstrate me something
- propose me something
- google me something
So fortunately, if you have a sense for which words sound Germanic and which sound Latinate/other, you can figure out if the construction works or not.