This could be truss lift if you have roof trusses in the house. The ceiling can actually lift up off the wall and leave a gap, usually on an interior wall. Truss Lift can be very ugly and tends to return each winter according to the weather.
If it is truss lift, I suggest you install crown molding or some trim mold in the room to cover the gap between the ceiling and the wall. BUT BE SURE TO NAIL THE CROWN MOLD ONLY TO THE CEILING so it can float up and down with the changing seasons. Install a wood nailer up first to attach the crown to and nail the wood nailer into the ceiling only.
Truss lift is affected by changes in temperature, moisture and heat from sunshine in the attic which affects how the wood trusses react and bend with nature. When the wood was a tree nobody noticed if the wood moved differently in the seasons. Now as part of your house the structural wood trusses now move instead of the tree just bending a little more. Go with it and cover it up. Truss lift is usually just an unsightly pain and little else.
Good Luck, as Mother Nature is undefeated.