Word for a person who wants to have problems to gain attention or sympathy

Solution 1:

That's called Martyr complex in psychology.

In psychology a person who has a martyr complex, sometimes associated with the term victim complex, desires the feeling of being a martyr for their own sake, seeking out suffering or persecution because it either feeds a psychical need or a desire to avoid responsibility. [Wikipedia]

Or try self-pity.

Self-pity is an emotion "directed towards others with the goal of attracting attention, empathy, or help" and one in which the subject feels sorry for (feels pity for) themselves. [Wikipedia]

That kind of person is called self-pitying person.