Yes,
OpenCPN can
record tracks of
AIS targets.
General
tracking of AIS targets may be enabled in the Toolbox -> Ships -> AIS Targets by enabling Show target tracks checkbox.
A non persistent track with length configured there is then shown for each target received.
Fro targets of your interest this track can be persisted from the target query information window, you can also let OpenCPN
record persistent track for that target for the rest of your session or until you manually turn it off.
You can configure group of targets you want to persistently track always in Toolbox -> Ships MMSI properties.
All the persistent tracks can be saved as GPX from the route and waypoint manager.
The related chapter of the manual can be found at
https://opencpn.org/wiki/dokuwiki/do...ar_buttons:ais