Can I compare p-values? Assume I have 2 vaccines A and B. They are tested on 2 groups of patients. Say each group has n=1000 people drawn from the same population, vaccine A is used on group 1 and vaccine B is used on group 2. It is observed that in group 1, 70 male patients and 40 female patients are cured, while in group 2, 55 male patients and 50 female patients are cured.
I can then test the following hypothesis:

*

*vaccine A is more effective on male patients than female

*vaccine B is more effective on male patients than female

Each hypothesis test will produce a p-value, p1 and p2. Now I see that p1 is smaller than p2, is there anything I can say regarding which vaccine is more effective on male patients?

Not an elaborated answer since we have already one, but a bit more focus on this part of the question:

Now I see that p1 is smaller than p2, is there anything I can say regarding which vaccine is more effective on male patients?

"The p-value is s the probability of obtaining test results at least as extreme as the results actually observed, under the assumption that the null hypothesis is correct". It is calculated from your sample and used to make inference about the larger population. It is associated to a specific null hypothesis.... and therefore make it complicated to be compared, as such, with another p-value.
Comparing significant with non significant p-value
In the example you provided (and assuming that male and female are equally distributed), the null hypothesis of the second test (vaccine B) cannot be rejected (p2-value = 0.606 for 2-sample test for equality of proportions)... So, a comparison of p-values will be even more than hazardous (if it had made sense), since it is not even significant.
The p-value tells only a little part of the story
Another illustration, the p-value of your first test (vaccine A) is p1-value = 0.0024 (2-sample test for equality of proportions) for 70 male patients and 40 female patients. However, you get a similar p-value of 0.0025 for 399 cured males and 358 cured females.
So, you get the same (or similar) p-value as your initial test for vaccine A, but the overall efficiency of the vaccine is much more important (covering 70% - 80 % of the patients). In such tests, the p-value does not tell you the story of each vaccine and hide their overall efficiency... which can lead to incorrect conclusions.
Below is an illustration of all possible pairs male/female (where vaccine A is more efficient on males) for a very similar p-value as your first test (vaccine A):

In other words, we get similar p-values if vaccine A cures 14 males and 2 females or if it cures 498 males and 486 females.
Finally, it has to tell a story that you can trust, which means that proper analysis must be carried out. Unfortunately, p-values do not tell much about the quality of the analysis: attractive p-values can actually hide poor analyses.
So, there is no other choice than stating a "new" null hypothesis that both vaccines A and B are more effective on male patients than female, as described by @Demetri.
I take advantage of this also to highlight the interesting link (direct access) mentioned by @StephanKolassa in comments (since comments are not always read): "The Difference Between “Significant” and “Not Significant” is not Itself Statistically Significant" - Gelman & Stern (2006).
