Alas, the answer is context, both syntactic and semantic. This answer may be unsatisfying because it doesn't give a general rule. But let's look at your examples. For the sentence
I know when he will come.
the subordinate clause is the direct object of know (and thus a noun clause). It can't be an adjunct, that is, a modifier of know, because know is present tense, and it's hard to see how a future action, one that hasn't happened yet, can affect the manner of knowing now. It's possible, however to construct an ambiguous sentence. Consider the following exchanges, perhaps from trial testimony:
Q1: What did you know about the robbery?
A1: I knew when he robbed a bank, but I didn't know which bank.
Noun clause: what I knew.
Q2: When did you realize he was dangerous?
A2: I knew when he robbed the bank, but not before.
Adverbial adjunct of time: when I knew.
Note that to know has a strong attraction for an immediately following direct object. You generally don't leave out what you know, unless it's clear from context:
Q3: Do you know that your shoe is untied?
A3: Yes, I know.
Clearly meaning I know that my shoe is untied.
Which is why A2 would more likely be phrased as
A2a: When he robbed the bank, I knew, but not before.
In your second example
I will buy this when he asks me to.
you know that the subordinate clause is an adjunct and not an object for two reasons. First, because this occupies the slot of direct object (the thing bought). If buy is to be used ditransitively, i.e., if it is to take a second object, such a second object must be an indirect object (the receiver of the purchase):
I will buy him this.
But a when clause can't mean a receiver of a transfer.
Secondly, the clause when he asks me to names a point in time, which is not a thing you can buy. So even if the sentence didn't already have a direct object, a point in time wouldn't make a suitable substitute direct object.
Thus with the clause precluded as an object, it must be an adjunct.