The first step in this question is the misunderstanding of 'evil' as a 'thing' with its existence independent of actors.
It is not, it is a quality of acts that are not loving: acts reflective of 'not-god'.
There is no such thing as 'evil', as a source of acts against others, these come from the human heart! (Matthew 15:19). Rather, it is a description of acts not for others, but against their interests. Acts not loving, acts of 'not-god'ness.
But why did God make us such that we could be 'non-god' in our thoughts and behaviour...and ultimately, in our relationships, our love?
Because God made us for relationship with him ('in his image'). For there to be a relationship, there has to be the possibility of no relationship, otherwise it is not a relationship (of love), but an inherent unavoidable 'given'.
But why did God make us for 'relationship' when this entails the possibility of no relationship? Was it for his pleasure, for a game he was playing with us?
No, it was for our pleasure. He made us for relationship with him because we would enjoy it...more than it is possible to enjoy anything else. That's what love is. It is for the other.
See also my post We're all basically good...aren't we?