In a nutshell
GPT is a decoder-only transformer: a token may look at the tokens before it but never ahead. That causal rule lets it be trained to predict the next token at every position at once, and to generate text left to right — one token at a time, feeding each new token back in (autoregressive).