にかこつけて is used to express that someone uses something as a pretext, excuse, or justification to do something else – often something they actually wanted to do anyway, or something self-serving. The nuance is that the stated reason is not the real or primary motivation; it is being used as a convenient cover.
The kanji form is にかこつけて託けて, from the verb かこつける託ける (かこつける), meaning "to use as a pretext." In practice, it is most often written in hiragana.
Attach にかこつけて to a noun (the pretext or excuse), then follow with the action that is actually being carried out under that guise.
This expression carries a negative or critical tone. The speaker implies that the person is being insincere or opportunistic – the stated reason is merely a convenient excuse. It is used to criticize or comment on someone's behavior, though it can also be used self-deprecatingly.