There are a number of possibilities. And we are in a situation of reduced knowledge. We don't know the nature of what was on the balloon. It's not clear exactly where it was launched. China is a very large place. It is not even necessarily the case it was launched from inside the country. It may have been launched over the ocean, just as an example. It's not clear which group (agency, faction, etc.) launched it.
So let's list some possibilities. With the degree of uncertainty, it's not really possible to make a clear decision as to which is more likely. This is all rank speculation. It may be fun though.
It could be a research balloon as claimed. It could be scientific research, doing things like sampling air temperature, wind speed, chemical content, and so on.
It could be a "look over there" device to distract from something else. Exactly what might be worth such a distraction is difficult to be clear on, since it is not clear exactly who launched it. It's not even clear if the distraction would be meant to distract people in the west or inside China.
It could be an over zealous mid-level type operative. Say about the level of a colonel or junior general. He may have taken some suggestion from a higher-up and just "run with it."
It could be intended to collect data that is difficult to get from satellites. Information like cell phone chatter and such.
It could be a "blue sky" type effort. Hey, let's try this and see what happens. Maybe nothing. Maybe we get lucky. At worst, we learn something about where balloons will go if released from such-and-such place. This is potentially useful information to tuck away for later use.
It could be a "brush back" activity. This is a term from baseball. If the batter is getting too aggressive, you send him a high-and-inside pitch to keep him thinking. The intent of this balloon could have been to say "I can look at you for days."
There was an official visit planned by a US official. Some faction in China may have perceived this as favoring some other faction. They may have deliberately sought to screw up the political relationship just enough to get the trip canceled. They may have perceived this as being such that the favored group was no longer favored.
Finally, my own pet theory. Note that I have nothing more than my own imagination to support this, any more than any of the other possibilities. It could be a thing of taking every slack inch. I'm not sure what the word for this is, but it is definitely present in Chinese political activity. It's even present in the daily lives of Chinese persons. Here is an example I experienced directly. I was in Beijing, waiting in line to get into a dinner theatre restaurant. Since the seats were all numbered and assigned with your ticket, there was no point in trying to rush the door. So, I and my GF were calmly waiting. But it was kind of boring not being able to sit. So I stood on tip-toe to look over the crowd to try to see if the doors were open. When I then stood back down on my heals, I found that the woman who was behind me had scooched so close behind me that her toes were under my heals. She did not even seem surprised I had stood on her toes. Nor did she make any attempt to back up from under my heals. She was trying to gain the few inches in line.
This sort of thing is not rare in places such as the border between India and China. Chinese forces will do things like coming and standing on the line they are not permitted to cross. Then they will walk a few steps over, stand there and look around. Then they will do things like picking up stones and carrying them back. Or bringing lawn chairs and sitting on the forbidden side. And so on. However far they get away with, they push a little farther and a little farther. Eventually it provokes a confrontation. Since this border location outlaws weapons on both sides, it has several times resulted in fights involving shoving, punching, throwing of stones, use of clubs, etc. Such confrontations have escalated to people being killed on both sides.
The idea of the balloon may have been like that. Crowd up so close to the boundary of acceptable behavior, even cross it just a little, to see how far they could get. If they get away with a balloon over the center of the US, then maybe next they try a drone. If they don't, maybe next it's a balloon over Alaska or Hawaii.