Both formats solve the same problem: designers animate in After Effects, and apps need to play that animation without a video file. Lottie does it with JSON exported by the Bodymovin plugin. PAG does it with a binary file exported by Tencent's own After Effects plugin.
PAG is open source and was built for Tencent's products, which use animation heavily in templates, stickers and video effects. Its strengths are a compact binary format, support for a wider range of After Effects features, and the ability to replace text and images inside an animation at runtime, which is useful for user-generated templates.
Lottie's strength is its ecosystem. Players exist for almost every platform and framework, many design tools export it, and there are large libraries of free animations. For most teams outside China, Lottie is the safer default.
Both formats play fixed animations. If your animation needs to react to the user, with states such as hover, pressed and loading, you need a state machine, either built in code around the player or authored in a tool such as Rive or ExodeUI, which we make.