If a giant octopus is in a tree, 15 feet above a human character, can the octopus attack/grapple that character and pull him 10 feet up towards itself in the air?
Rules Don't Cover Everything
The D&D rules don't cover everything. They cover the most common things a creature might do. Squids and octopi are interesting. They, in real life, can change size. Where size is rigid in the simulationist world of D&D. So I think this is where the rules like this come into play:
Your character can do things not covered by the actions in this chapter […] The only limits to the actions you can attempt are your imagination and your character's ability scores. (PHB, p. 193)
There is a similar stating of Rule of Cool in the DMG, I might add it later if I remember.
How I'd do it as DM
I, as a DM, would (and have) use the shoving rules in reverse:
Shoving a Creature
Using the Attack action, you can make a special melee attack to shove a creature, either to knock it prone or push it away from you. If you're able to make multiple attacks with the Attack action, this attack replaces one of them.
The target must be no more than one size larger than you and must be within your reach. Instead of making an attack roll, you make a Strength (Athletics) check contested by the target's Strength (Athletics) or Dexterity (Acrobatics) check (the target chooses the ability to use). If you win the contest, you either knock the target prone or push it 5 feet away from you.
So I'd do everything I would for a push, just instead of moving the creature away I'd move them closer.
Otherwise, the octopod could move closer by 5 feet, pull the target with him 5 feet up, repeat until 1/2 the octopod's movement is used up...
The Octopus can't pull you to it
However, it can move further up the tree (dragging you in the same direction) and it can move closer to you (closing the distance for any further grapple-movement) but it cannot directly pull you to it while maintaining its position.
Here's the relevant quote in the grapple rules which determines how you move your target:
When you move, you can drag or carry the grappled creature with you, but your speed is halved, unless the creature is two or more sizes smaller than you.
Note that it requires your own movement, and that "you can drag...the grappled creature with you". There is no other reference to how you can move the target outside of this quote.
For a more in-depth understanding, you can review the answer to the question, If I am grappled by an enemy with 10' + reach, how does our movement work?.