If your goal is to train, the trainer is a good complement to riding outside:
- control of the training: the companion apps are usually proposing modes/exercices that can be difficult to replicate on the road in your area.
- you can "ride" when you want: personal example, I don't like to ride during the night, the trainer opens the possibility to train at this period during the week.
- you can have a feel of conditions that do not exist in your area: if you live in the Netherlands, a trainer can give you a (limited) feel of the kind of effort required to ride an Alpine pass.
- you can try harder than you would normally do on a ride: since you don't have to bother about coming back, it's somehow easier to 'explore' the limits. If you've tried too hard on a trainer, you can just stop.
- the social aspects can make it stimulating, as riding alone for training can be boring.
- since you don't have to concentrate on the road and the traffic, you can combine it with stuff like watching a TV show or listening to a podcast
But there are aspects that the trainer doesn't train for: managing wind, riding in group/peloton, riding techniques (improving your cornering skills for example), endurance training (you 'can' do endurance training on a trainer, but after 1 hour, the trainer starts to be boring for me).
But of course, you don't have one of the fun parts of biking, which is to be in the outdoors enjoying some nice landscape and if it applies to you the adrenaline rush because of speed.