was planning to, butUsed to say that someone intended or planned to do something, but the plan was not carried out or was followed by an unexpected result. が means “but” here.
JA: 明日早く起きるつもりだったが、寝坊してしまった。
EN: I was planning to get up early tomorrow, but I overslept.